static async Task GetOrderingPartyWithModelModel() { var context = OrderingPartyTestContext.Setup(); var controller = context.OrderingPartyController; await controller.UpdateAsync("OrderId", null); }
public async Task GetAsync_GetOrderById_CalledOnce() { var context = OrderingPartyTestContext.Setup(); var controller = context.OrderingPartyController; await controller.GetAsync(string.Empty); context.OrderRepositoryMock.Verify(x => x.GetOrderByIdAsync(string.Empty), Times.Once); }
public async Task GetAsync_OrderIdDoesNotExist_ReturnsNotFound() { var context = OrderingPartyTestContext.Setup(); var controller = context.OrderingPartyController; var response = await controller.GetAsync("INVALID"); response.Result.Should().BeOfType <NotFoundResult>(); }
public async Task UpdateAsync_OrderIdDoesNotExist_ReturnNotFound(string orderId) { var context = OrderingPartyTestContext.Setup(); var controller = context.OrderingPartyController; var response = await controller.UpdateAsync(orderId, new OrderingPartyModel { PrimaryContact = new PrimaryContactModel() }); response.Should().BeEquivalentTo(new NotFoundResult()); }
public async Task GetAsync_EmptyOrderingParty_ReturnsEmptyResult() { const string orderId = "C0000014-01"; var context = OrderingPartyTestContext.Setup(); (Order order, OrderingPartyModel _) = CreateOrderingPartyTestData(orderId, context.PrimaryOrganisationId, false); context.Order = order; var controller = context.OrderingPartyController; var result = await controller.GetAsync(orderId); result.Result.Should().BeOfType <OkResult>(); }
public async Task GetAsync_OrderIdExists_ReturnsTheOrderingParty() { const string orderId = "C0000014-01"; var context = OrderingPartyTestContext.Setup(); (Order order, OrderingPartyModel expectedOrderingParty) = CreateOrderingPartyTestData(orderId, context.PrimaryOrganisationId); context.Order = order; var controller = context.OrderingPartyController; var result = await controller.GetAsync(orderId); result.Should() .BeEquivalentTo(new ActionResult <OrderingPartyModel>(new OkObjectResult(expectedOrderingParty))); }
public async Task GetAsync_WrongOrganisationId_ReturnsForbidden() { var context = OrderingPartyTestContext.Setup(); const string orderId = "C0000014-01"; (Order order, _) = CreateOrderingPartyTestData(orderId, Guid.NewGuid()); context.Order = order; var controller = context.OrderingPartyController; var result = await controller.GetAsync(orderId); result.Result.Should().BeOfType <ForbidResult>(); }