Subsonic 3.0 testing - what am I missing here?

こ雲淡風輕ζ 提交于 2019-12-13 04:22:09

问题


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???


回答1:


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



来源:https://stackoverflow.com/questions/1341073/subsonic-3-0-testing-what-am-i-missing-here

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!