Beispiel #1
0
        public void CallByNameTest()
        {
            //expected
            Wolf   wolf   = new Wolf("Вова", "ч");
            Wolf   wolf1  = new Wolf("Чуйка", "ж");
            Wolf   wolf2  = new Wolf("Чуйка", "ж");
            Volary volary = new Volary();

            volary.Add(wolf);
            volary.Add(wolf1);
            volary.Add(wolf2);
            VolaryStub volaryStub = new VolaryStub();

            volary.volary = volaryStub;
            string        expexted     = "expexted";
            List <string> expectedList = new List <string>()
            {
                "expectedList"
            };

            Mock.Arrange(() => wolf1.Voice()).Returns(expexted);
            Mock.Arrange(() => wolf2.Voice()).Returns(expexted);
            Mock.Arrange(() => volaryStub.Call(Arg.IsAny <string>())).Returns(expectedList);

            // actual
            List <string> list = volary.Call("Чуйка");

            Assert.AreEqual(expexted, list[0]);
            Assert.AreEqual(expexted, list[1]);
            Assert.AreEqual(expectedList[0], list[2]);
            Assert.AreEqual(3, list.Count);
        }
Beispiel #2
0
        public void CallTest()
        {
            //expected
            Wolf   wolf   = new Wolf("Happy Wolf", "ч");
            Volary volary = new Volary();

            volary.Add(wolf);
            VolaryStub volaryStub = new VolaryStub();

            volary.volary = volaryStub;
            string        expexted     = "expexted";
            List <string> expectedList = new List <string>()
            {
                "expectedList"
            };

            Mock.Arrange(() => wolf.Voice()).Returns(expexted);
            Mock.Arrange(() => volaryStub.Call()).Returns(expectedList);

            // actual
            List <string> list = volary.Call();

            Assert.AreEqual(expexted, list[0]);
            Assert.AreEqual(expectedList[0], list[1]);
        }