fluent-assertions Questions
2
Solved
I am writing some unit tests using specflow and need a way to check whether a list of objects is ordered by a specific property. Currently I am doing it like this, but I am not sure if this is the ...
Augmenter asked 15/10, 2015 at 8:46
1
Solved
I have a nested class and FluentAssertions can assert them.
Then I change class to struct and the test fails.
( If I change IEnumerable<ItemStruct> MyItems { get; set; } to ItemStruct MyIte...
Triangle asked 4/4, 2019 at 19:56
4
Solved
I'm stuck with what I thought was an easy example.
I want to assert that a collection of objects contains an object that is equivalent to a given object. like: col.ShouldContainEquivalentTo(obj)
v...
Paleontology asked 28/6, 2017 at 22:24
1
Solved
I'm using FluentAssertions with NUnit and I realize that the method Throw() and other related methods is not listed for me to use. Do I have to install any other package to have access to this meth...
Ilyssa asked 7/11, 2018 at 21:57
3
Solved
I am using Fluent Assertion library as part of my unit tests for some custom serialization code and I am looking for a way to force ShouldBeEquivalentTo to compare as equal a null and empty list.
...
Billbug asked 22/8, 2016 at 16:59
1
Solved
I have the following test illustrating a simple example of what im attempting to achieve (comparison of two equivalent lists):
[Fact]
public void Test()
{
// Arrange
var list1 = new List<IDom...
Cylindroid asked 14/8, 2018 at 17:27
2
Solved
probably a simple one, but cant get it to work;
i've changed the signature one on the methods to Task
On my unit tests i am using fluent assertions.
but cant get this to work:
_catalogVehicle...
Nitid asked 2/8, 2018 at 20:28
2
Solved
I'm implementing sortable columns on my Kendo grid and the user-expected behaviour is to allow multiple columns to be sorted at the same time.
Naturally, I'm starting off by writing a unit test to...
Craigcraighead asked 2/7, 2018 at 16:24
1
Solved
I'm not sure if an old version of FluentAssertions had this or not but I'd like to compare a collection to another collection. I have a dto like so:
public class UserDTO
{
public int Id { get; se...
Tour asked 22/6, 2018 at 1:11
1
Solved
I am trying to use Nspec. I have followed these instructions: http://nspec.org/
Create a class library project
Nuget: Install-Package nspec
Nuget: Install-Package FluentAssertions
Create a cla...
Hindquarter asked 6/3, 2018 at 10:17
1
Solved
How to compare objects that have a property with the same name but different type?
public class A
{
public Guid Id { get; set; }
}
public class B
{
public string Id { get; set; }
}
public stat...
Fain asked 1/3, 2018 at 16:14
1
How can I easy compare string case insensitive using FluentAssertions?
Something like:
symbol.Should().Be(expectedSymbol, StringComparison.InvariantCultureIgnoreCase);
Edit: Regarding poss...
Accentuate asked 28/12, 2017 at 9:59
2
Solved
I have public class RuleInfo which is created from internal class Rule.
private static RuleInfo CreateRuleInfo(Rule r)
{
return new RuleInfo
{
RuleCode = r.RuleId,
DisplayName = r.RuleCode,
D...
Telegraphic asked 22/12, 2017 at 19:29
2
Solved
What I'm trying to do
I've just set up a test to ensure that a NodaTime LocalDateTime is mapped to a .NET DateTime, retaining the same date and time values. I'm using FluentAssertions' ShouldBeEqu...
Encasement asked 28/11, 2013 at 4:41
3
I have 2 dictionaries and I would expect the contents not to be equivalent as the dictionary contains values of different types. However the following test passes
[Scenario]
public void Dictionari...
Baudelaire asked 11/6, 2014 at 7:21
2
Solved
Using FluentAssertions:
I'm able to exclude a single property using ShouldBeEquivalentTo.
x.ShouldBeEquivalentTo(y, opts => opts.Excluding(si => !si.PropertyInfo.CanWrite));
But, how do I...
Lemay asked 8/11, 2016 at 10:18
1
Solved
I have a list, every single element should also show up in another list, but not necessarily in the same order.
I could probably do the assert with a foreach, like this
Assert.IsTrue(list1.Count ...
Jaffa asked 8/8, 2017 at 18:49
2
Solved
I'm using NUnit 2.6.2 + Fluent Assertions 2.0.1.
I want to assert that two references do NOT point to the same object instance. I can't find a clean way to express that.
NUnit has Assert.Referen...
Maccabees asked 19/7, 2013 at 8:47
2
Solved
I have a unit test that validates that some code throws an exception and that two properties have the expected value. Here is how I do it:
var exception = target.Invoking(t => t.CallSomethingTh...
Pomiferous asked 14/11, 2016 at 15:14
1
Solved
I just start to use Moq & FluentAssertions and find this:
results.Results.Count.Should().Equals(1);
in the code, results.Results return a list of class List. In the test setup, I set it as r...
Aerobe asked 15/6, 2016 at 21:55
1
Solved
I have a class Vector3D that has the properties X, Y and Z of type double (it also has other properties such as Magnitude).
What is the best way of approximately comparing all the properties or a ...
Ashok asked 22/4, 2016 at 1:9
2
Solved
OK, I am running a unit test to see if the Exception.Data property contains a specific value against a specific named key.
Exception.Data is of type IDictionary. IDictionary only has 2 overloads w...
Ician asked 19/1, 2016 at 14:41
2
Solved
I am working with fluent assertions in my unit tests, however the use of ShouldBeEquivalentTo, ShouldAllBeEquivalentTo, and BeEquivalentTo is unclear.
For example; all the following statements pas...
Finedrawn asked 19/12, 2015 at 14:31
1
Solved
I try to use FluentAssertions to check in my UnitTest, that the type of a property in a list of items is of a certain type.
myObj.Items.OfType<TypeA>().Single()
.MyProperty1.GetType()
.Shou...
Propolis asked 28/10, 2015 at 10:21
3
Solved
I'm processing a number of items, each of which contain a DateProcessed property (a nullable DateTime) and want to Assert that the property is set to the current date. By the time it gets through t...
Iterative asked 16/7, 2014 at 10:28
© 2022 - 2024 — McMap. All rights reserved.