Quantcast
Channel: Fluent Assertions
Viewing all 1402 articles
Browse latest View live

New Post: Comparing two similar objects fails

$
0
0

FieldOffset is a property of class DieCorner:

    [Serializable]
    public class DieCorner: Entity
    {
        public DieCorner()
        {
        }

        public DieCorner(ImageData imageData, WaferPosition waferPosition)
        {
            Image = imageData;
            Position = waferPosition;
        }
        
        public WaferPosition Position { get; set; }

        public FieldOffset InFieldOffset { get; set; }

        public ImageData Image { get; set; }
    }

 

The comparison is done like this:

convertedGeometry.DieCorner.ShouldHave().AllProperties().EqualTo(expectedGeometry.DieCorner);

What am I missing?

Thanks!


New Post: Comparing two similar objects fails

$
0
0

I think I got it, is it because the FieldOffset is a reference type and the references are being compared?

IncludeNestedProperties() should be added, correct?

What if i have multiple levels of nesting, and deep down there are couple of collections, how should I caompare the collections? will IncludeNestedProperties() work, or should I use .AllPropertiesBut(collection) and then compare the collection explicitly? 

Thanks!

New Post: Comparing two similar objects fails

New Post: Should().Equal() vs Assert.AreEqual on empty collections

$
0
0

I'm struggling with something. I'm looking to verify that two empty lists refer to the same object:

    var liste1 = new List<string>();
    var liste2 = new List<string>();
    (liste1 == liste2).Should().BeFalse();
    liste1.Should().Equal(liste2);   // This one passes, but I thought it was using Object.Equals ?
    Assert.AreEqual(liste1, liste2); // This one fails, which is what I want in this case 

Is there another Fluent method I could use to compare the two references?

            var liste1 = new List<string>();
            var liste2 = new List<string>();
            (liste1 == liste2).Should().BeFalse();
            liste1.Should().Equal(liste2);   // This one passes, but I thought it was using Object.Equals ?
            Assert.AreEqual(liste1, liste2); // This one fails, which is what I want in this case

New Post: Should().Equal() vs Assert.AreEqual on empty collections

$
0
0

Should().Equal() will compare the individual items within the two collections, but doesn't care about the collection type itself. Unfortunately, we don't have the Should().BeSameAs() on the collection, unless you do something like liste1.Should<object>().BeSameAs(liste2);

New Post: Should().Equal() vs Assert.AreEqual on empty collections

Source code checked in, #1ee4840c4a15

$
0
0
Minor rework while reviewing a pull request.

Created Issue: BeOfTypeImplements to test IEnumerable instead of specific implementation (list/dictionary) [12463]

$
0
0
Unit tests for my controller include type validation of the model.
I first attempted:
ViewResult.Model.Should().BeOfType<IEnumerable<model>>()

but it failed, stating that the type is List<model>
This is true, but I don't want to worry about that during my testing... I just need to verify that the model is IEnumerable

As a result, I must use:
ViewResult.Model.GetType().Implements<IEnumerable<model>>().Should().BeTrue()

I would prefer something along the lines of:
- some sort of optional parameter for the BeOfType() to allow classes that inherit/implement T
or
- BeOfTypeImplementing<>


PS: keep up the great work... FA is probably my most frequently used nuget package :)

Source code checked in, #729db4bd1a6e

$
0
0
Added UpgradeLog.htm file to gitignore

Commented Issue: BeOfTypeImplements to test IEnumerable instead of specific implementation (list/dictionary) [12463]

$
0
0
Unit tests for my controller include type validation of the model.
I first attempted:
ViewResult.Model.Should().BeOfType<IEnumerable<model>>()

but it failed, stating that the type is List<model>
This is true, but I don't want to worry about that during my testing... I just need to verify that the model is IEnumerable

As a result, I must use:
ViewResult.Model.GetType().Implements<IEnumerable<model>>().Should().BeTrue()

I would prefer something along the lines of:
- some sort of optional parameter for the BeOfType() to allow classes that inherit/implement T
or
- BeOfTypeImplementing<>


PS: keep up the great work... FA is probably my most frequently used nuget package :)
Comments: You can use BeAssignableTo<> for that. Like this: ViewResult.Model.Should().BeAssignableTo<IEnumerable<model>>();

Source code checked in, #235a83293bdc

Source code checked in, #1730c0c30686

$
0
0
Merge https://git01.codeplex.com/forks/ndroe/fluentassertions

Source code checked in, #f12adb828cdd

$
0
0
Removed duplicate implementations of some TypeExtensions.

Source code checked in, #046526cd01c2

$
0
0
Created an extension method GetMethodNamed(string methodName) on Type, to abstract the distinction between WinRT and other projects. Updated a small number of the usages.

New Post: DateTimeOffset

$
0
0

It would be great if FA supported DateTimeOffset in the same way it supported DateTime.


Created Issue: DateTimeOffset support [12464]

$
0
0
It would be great if FA supported DateTimeOffset in the same way it supported DateTime.

New Post: DateTimeOffset

$
0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.

New Post: Access to EventRecorder

$
0
0

Hi,

Would you consider making to possible to get the EventRecorder for an object and event, so that it is possible to write custom assertions. Without having to save the IEnumerable<EventRecorder> when calling MonitorEvents?

Best regards

Kim

Created Issue: Access to EventRecorder [12465]

$
0
0
Hi,

Would you consider making to possible to get the EventRecorder for an object and event, so that it is possible to write custom assertions. Without having to save the IEnumerable<EventRecorder> when calling MonitorEvents?

Best regards

Kim

New Post: Access to EventRecorder

$
0
0
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Viewing all 1402 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>