public void GivenValidData_Handle_WritesOkObjectResult() { var customer = new Infrastructure.InMemoryGateway.Customer( new SSN("198608178888"), new Name("Ivan Paulovich") ); var account = new Infrastructure.InMemoryGateway.Account( customer ); var registerOutput = new RegisterOutput( customer, account ); var sut = new RegisterPresenter(); sut.Standard(registerOutput); var actual = Assert.IsType <CreatedAtRouteResult>(sut.ViewModel); Assert.Equal((int)HttpStatusCode.Created, actual.StatusCode); var actualValue = (RegisterResponse)actual.Value; Assert.Equal(customer.Id, actualValue.CustomerId); }
public void GivenValidData_Handle_WritesOkObjectResult() { var customer = new Infrastructure.InMemoryDataAccess.Customer( new CustomerId(Guid.NewGuid()), new SSN("198608178888"), new Name("Ivan Paulovich"), Array.Empty <AccountId>()); var account = new Infrastructure.InMemoryDataAccess.Account( new AccountId(Guid.NewGuid()), customer.Id, Array.Empty <Infrastructure.InMemoryDataAccess.Credit>(), Array.Empty <Infrastructure.InMemoryDataAccess.Debit>() ); var registerOutput = new RegisterOutput( new ExternalUserId("github/ivanpaulovich"), customer, account); var sut = new RegisterPresenter(); sut.Standard(registerOutput); var actual = Assert.IsType <CreatedAtRouteResult>(sut.ViewModel); Assert.Equal((int)HttpStatusCode.Created, actual.StatusCode); var actualValue = (RegisterResponse)actual.Value; Assert.Equal(customer.Id.ToGuid(), actualValue.CustomerId); }