public async Task GetAccountLegalEntity_WithValidModelButInvalidId_ShouldReturnNotFound() { const long accountLegalEntityId = 456; // arrange var fixtures = new AccountLegalEntityControllerTestFixtures() .SetQueryResponse(accountLegalEntityId, null); // act var response = await fixtures.CallControllerMethod(accountLegalEntityId); // Assert Assert.AreEqual(typeof(NotFoundResult), response.GetType()); var objectResult = (NotFoundResult)response; Assert.AreEqual(404, objectResult.StatusCode); }
public async Task GetAccountLegalEntity_WithValidModelAndExistingId_ShouldReturnOkayAndContent() { const long accountLegalEntityId = 456; // arrange var fixtures = new AccountLegalEntityControllerTestFixtures() .SetQueryResponse(accountLegalEntityId, new GetAccountLegalEntityQueryResult()); // act var response = await fixtures.CallControllerMethod(accountLegalEntityId); // Assert Assert.AreEqual(typeof(OkObjectResult), response.GetType()); var objectResult = (OkObjectResult)response; Assert.AreEqual(200, objectResult.StatusCode); }
public async Task GetAccountLegalEntity_WithValidModelAndExistingId_ShouldResultMappedCorrectly() { const long accountLegalEntityId = 456; // arrange var fixtures = new AccountLegalEntityControllerTestFixtures() .SetQueryResponse(accountLegalEntityId, new GetAccountLegalEntityQueryResult { AccountId = 1, MaLegalEntityId = 234, AccountName = "AccountName", LegalEntityName = "ABC", LevyStatus = ApprenticeshipEmployerType.Levy }); // act var response = await fixtures.CallControllerMethod(accountLegalEntityId); // Assert var model = response .VerifyReturnsModel() .WithModel <AccountLegalEntityResponse>(); Assert.AreEqual(1, model.AccountId); Assert.AreEqual(234, model.MaLegalEntityId); Assert.AreEqual("AccountName", model.AccountName); Assert.AreEqual("ABC", model.LegalEntityName); Assert.AreEqual(ApprenticeshipEmployerType.Levy, model.LevyStatus); }