Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
267 views
in Technique[技术] by (71.8m points)

Subsonic 3.0 testing - what am I missing here?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is logged as an issue on github, it would be worth you adding any info you can to it though.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...