예제 #1
0
        public PartialViewResult _15([FromBody] Ex15ViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                RedirectToAction(nameof(_15));
            }

            Ex15 ex = new Ex15(vm.Username, vm.Password);

            vm.Result = ex.IsValid() ? "Welcome!" : "I don't know you.";

            return(PartialView("_15_partial", vm));
        }
예제 #2
0
        public void _15_WhenEnteringWrongCredentials_SholudFalse()
        {
            // Arrange
            string userName = "******";
            string password = "******";
            //bool expected = true;
            Ex15 ex = new Ex15(userName, password);

            // Act
            bool actual = ex.IsValid();

            // Assert
            Assert.IsFalse(actual);
        }