public void Equals_EqualByDateAndCode_True() { // Arrange var x = new ExchangeRate { Code = "Test", Date = new DateTime(2017, 1, 1) }; var y = new ExchangeRate { Code = x.Code, Date = x.Date }; var comparer = new ExchangeRateComparer(); // Act var isEqual = comparer.Equals(x, y); // Assert isEqual.Should().BeTrue(); }
public void Equals_EqualByRate_False() { // Arrange var x = new ExchangeRate { Code = "Test", Date = new DateTime(2017, 1, 1), Rate = 1 }; var y = new ExchangeRate { Code = "Test2", Date = x.Date.AddDays(1), Rate = x.Rate }; var comparer = new ExchangeRateComparer(); // Act var isEqual = comparer.Equals(x, y); // Assert isEqual.Should().BeFalse(); }