Rhino Mocks - Stub .Expect vs .AssertWasCalled

前端 未结 3 2192
独厮守ぢ
独厮守ぢ 2020-12-07 23:00

OK, I know there has been a lot of confusion over the new AAA syntax in Rhino Mocks, but I have to be honest, from what I have seen so far, I like. It reads better, and sa

3条回答
  •  醉酒成梦
    2020-12-07 23:29

    I think it has to do with what your manager.ListCount() is doing with the return value.

    If it is not using it then your DAL can return anything it won't matter.

    public class Manager
    {
        public Manager(DAL data)
        { 
            this.data = data
        }
        public void ListCount()
        {
            data.ListCount(1); //Not doing anything with return value
            DoingSomeOtherStuff();
        }    
    }
    

    If your list count is doing something with the value you should then put assertions on what it is doing. For exemple

    Assert.IsTrue(manager.SomeState == "someValue");
    

提交回复
热议问题