Esempio n. 1
0
        public void ShouldAssertOccurenceWhenCombinedWithNoSetupCalls()
        {
            string userName = "******";
            string password = "******";

            ILoginService service = Mock.Create <ILoginService>();

            Mock.Arrange(() => service.ValidateUser(userName, password)).Returns(5).OccursOnce();
            Mock.Arrange(() => service.ValidateUser("foo", "bar")).OccursNever();

            SecurityHandler handler = new SecurityHandler(service);

            bool loggedIn = handler.LoginUser(userName, password);

            Assert.True(loggedIn);
            Assert.Equal(handler.UserID, 5);

            Mock.Assert(service);
        }