Beispiel #1
0
        public void Check_That_Right_Method_Was_Called_Inside_IsUserNameAvailable_Action()
        {
            // Arrange
            var mockUserService = new Mock <IUserService>();

            mockUserService.Setup(m => m.UserExists(It.IsAny <string>()))
            .Returns(false);

            ValidationController validationController = GetValidationController(mockUserService: mockUserService);

            const string userName = "******";

            // Act
            validationController.IsUserNameAvailable(userName);

            // Assert
            mockUserService.Verify(m => m.UserExists(userName));
        }