Exemple #1
0
        public void ListTest()
        {
            ITestInterface testMock = MockRepository.Mock <ITestInterface>();

            testMock.Expect(x => x.VoidList(Arg <List <string> > .List.Count(Is.GreaterThan(3))));
            testMock.Expect(x => x.VoidList(Arg <List <string> > .List.IsIn("hello")));

            testMock.VoidList(new List <string>(new string[] { "1", "2", "4", "5" }));
            testMock.VoidList(new List <string>(new string[] { "1", "3" }));

            Assert.Throws <ExpectationViolationException>(
                () => testMock.VerifyExpectations());
        }
        public void ListTest()
        {
            ITestInterface testMock = mocks.StrictMock <ITestInterface>();

            testMock.VoidList(Arg <List <string> > .List.Count(Is.GreaterThan(3)));
            testMock.VoidList(Arg <List <string> > .List.IsIn("hello"));

            mocks.ReplayAll();

            testMock.VoidList(new List <string>(new string[] { "1", "2", "4", "5" }));

            Assert.Throws <ExpectationViolationException>(
                "ITestInterface.VoidList(System.Collections.Generic.List`1[System.String]); Expected #0, Actual #1.",
                () => testMock.VoidList(new List <string>(new string[] { "1", "3" })));
        }