Tests/Identity.Infrastructure.Tests/Services/IdentityServiceTests.cs
/// <summary>
/// Given a not null request
/// And creation is done succcessfully
/// when creating new user
/// return success result message
/// </summary>
Given a not null request
And creation is done succcessfully
when creating new user
return success result message
Given a not null request And creation is done succcessfully when creating new user return success result message
[Fact]
        public async Task CreateUserAsync_GivenNotNullRequest_SuccessfulCreation_ReturnSuccessMessage()
        {
            UserCreationRequest request = new UserCreationRequest
            {
                Email = "nana@hotmail.com",
                Login = "nani",
                Password = "screwyouPass"
            };
            _userManagerMock.Setup(mock => mock.CreateAsync(It.Is<User>(user => user.Email == request.Email
                && user.UserName == request.Login), request.Password)).ReturnsAsync(IdentityResult.Success);
            ResultMessage result = await _identityService.CreateUserAsync(request).ConfigureAwait(false);
            Assert.NotNull(result);
            Assert.True(result.OperationStatus);
        }
[ Fact ] public async Task CreateUserAsync_GivenNotNullRequest_SuccessfulCreation_ReturnSuccessMessage ( ) { UserCreationRequest request = new UserCreationRequest { Email = " " , Login = " " , Password = " " } ; _userManagerMock . Setup ( mock => mock . CreateAsync ( It . Is < User > ( user => user . Email == request . Email && user . UserName == request . Login ) , request . Password ) ) . ReturnsAsync ( IdentityResult . Success ) ; ResultMessage result = await _identityService . CreateUserAsync ( request ) . ConfigureAwait ( false ) ; Assert . NotNull ( result ) ; Assert . True ( result . OperationStatus ) ; }
Given a not null request
And creation is done succcessfully
when creating new user
return success result message
Given a not null request And creation is done succcessfully when creating new user return success result message
// Arrange // Act // Assert