EDIT: This issue is already submitted on Github. Changing the "Act" part to this will make the test pass
var result = Adresse.All()
.Where(x => x.AdresseX == txt1 && x.PostBy == txt2)
.FirstOrDefault();
[TestMethod]
public void WTF()
{
//Arrange
string txt1 = "Vingsted Skovvej 1";
string txt2 = "7100 Vejle";
var one = new Adresse { ID = 1, AdresseX = "Vejlevej 55", PostBy = "7300" };
var two = new Adresse {ID = 2, AdresseX = txt1, PostBy = txt2 };
Adresse.Setup(new List<Adresse> { one, two });
//Act
var result = Adresse.SingleOrDefault(x => x.AdresseX == txt1 && x.PostBy == txt2);
//Assert
Assert.AreEqual(2, result.ID);
}
The following test fails me because I get the first object back (the one where ID equals 1)... Can somebody explain to me what I'm doing wrong???
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…