jeudi 2 juin 2016

FluentAssertions: How to compare properties of a different name

I have two objects of the same type that I need to compare, but the value of one object property on objectA should be equal to a property of a different name on objectB.

Given my object:

class MyObject
{
    public string Alpha {get; set;}
    public string Beta {get; set;}
}

var expected = new MyObject {"string1", "string1"};
var actual = new MyObject {"string1", null};

I need to verify that actual.Alpha == expected.Alpha and actual.Beta == expected.Alpha

Can this be done?

Aucun commentaire:

Enregistrer un commentaire