I have a unit test with FluentAssertions, where I want to test an object equivalent.
[TestFixture]
public class TaskCompletionTest
{
private string _callId;
private List<Step> _steps;
private SolidColorBrush _solidColor;
[SetUp]
public void ReInitializeTest()
{
_callId = _faker.Name.FullName();
_steps = new List<Step> { new Step { Name = "Step1" }, new Step { Name = "Step2" } };
_solidColor = new SolidColorBrush(Color.FromRgb(0, 0, 0));
}
[Test]
public void ShouldCreateTaskCompletion()
{
//Arrange
var taskCompletion = new TaskCompletionwModel(_callId, _steps);
//Acts
var taskCompletionExpected = new
{
CallId = _callId,
Steps = _steps,
StatusColor = _solidColor
};
//Assert
taskCompletionExpected.Should().BeEquivalentTo(taskCompletion);
}
}
public class Step
{
public string Name { get; set; }
}
public class TaskCompletionwModel
{
public string CallId { get; private set; }
public List<Step> Steps { get; private set; }
public SolidColorBrush StatusColor { get; set; } = new SolidColorBrush(Color.FromRgb(0, 0, 0));
public TaskCompletionwModel(string callId, List<Step> steps)
{
CallId = callId;
Steps = steps;
}
}
When I run the test I have this. Expected member StatusColor to be #FF000000, but found #FF000000.
With configuration: - Use declared types and members - Compare enums by value - Match member by name (or throw) - Without automatic conversion. - Be strict about the order of items in byte arrays
Why this test doesn´t work?
Best regards. Jolynice