public void ValidCommand_IsValid() { var input = new LoginLocalUserRequest { Login = "******", Password = "******", SecurityContext = A.Dummy <ISecurityContext>() }; var actualResult = _sut.Validate(input); Assert.That(actualResult.IsValid, Is.True); }
public void NullPassword_IsInvalid() { var input = new LoginLocalUserRequest { Login = "******", Password = null, SecurityContext = A.Dummy <ISecurityContext>() }; var actualResult = _sut.Validate(input); Assert.That(actualResult.IsValid, Is.False); }
public void ParsesRequestCorrectly() { LoginLocalUserRequest interceptedRequest = null; A.CallTo(() => _loginLocalUserHandler.Handle(A <LoginLocalUserRequest> ._)) .Invokes(call => interceptedRequest = call.GetArgument <LoginLocalUserRequest>(0)) .Returns(true); var securityContext = A.Fake <ISecurityContext>(); ConfigureSecurityContextFactory_ToReturn(securityContext); Post(); var expected = new LoginLocalUserRequest { Login = "******", Password = "******", SecurityContext = securityContext }; interceptedRequest.ShouldBeEquivalentTo(expected); }
public void GivenMissingBodyInRequest_CallsInnerHandlerWithEmptyRequest() { LoginLocalUserRequest interceptedRequest = null; A.CallTo(() => _loginLocalUserHandler.Handle(A <LoginLocalUserRequest> ._)) .Invokes(call => interceptedRequest = call.GetArgument <LoginLocalUserRequest>(0)) .Returns(true); var securityContext = A.Fake <ISecurityContext>(); ConfigureSecurityContextFactory_ToReturn(securityContext); var response = Post(null); Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK)); var expected = new LoginLocalUserRequest { Login = null, Password = null, SecurityContext = securityContext }; interceptedRequest.ShouldBeEquivalentTo(expected); }