public async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); var createModel = new ApiSaleRequestModel(); createModel.SetProperties(2m, "B", "B", 1, 1, "B"); CreateResponse <ApiSaleResponseModel> createResult = await client.SaleCreateAsync(createModel); createResult.Success.Should().BeTrue(); ApiSaleResponseModel getResponse = await client.SaleGetAsync(2); getResponse.Should().NotBeNull(); ActionResponse deleteResult = await client.SaleDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiSaleResponseModel verifyResponse = await client.SaleGetAsync(2); verifyResponse.Should().BeNull(); }
private async Task <ApiSaleResponseModel> CreateRecord() { var model = new ApiSaleRequestModel(); model.SetProperties(2m, 1, "B", 1, DateTime.Parse("1/1/1988 12:00:00 AM"), 2); CreateResponse <ApiSaleResponseModel> result = await this.Client.SaleCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
private async Task <ApiSaleResponseModel> CreateRecord(ApiClient client) { var model = new ApiSaleRequestModel(); model.SetProperties(2m, "B", "B", 1, 1, "B"); CreateResponse <ApiSaleResponseModel> result = await client.SaleCreateAsync(model); result.Success.Should().BeTrue(); return(result.Record); }
public void MapModelToBO() { var mapper = new BOLSaleMapper(); ApiSaleRequestModel model = new ApiSaleRequestModel(); model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1); BOSale response = mapper.MapModelToBO(1, model); response.IpAddress.Should().Be("A"); response.Note.Should().Be("A"); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionId.Should().Be(1); }
public void MapModelToBO() { var mapper = new BOLSaleMapper(); ApiSaleRequestModel model = new ApiSaleRequestModel(); model.SetProperties(1m, "A", "A", 1, 1, "A"); BOSale response = mapper.MapModelToBO(1, model); response.Amount.Should().Be(1m); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.PaymentTypeId.Should().Be(1); response.PetId.Should().Be(1); response.Phone.Should().Be("A"); }
public void MapModelToBO() { var mapper = new BOLSaleMapper(); ApiSaleRequestModel model = new ApiSaleRequestModel(); model.SetProperties(1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1); BOSale response = mapper.MapModelToBO(1, model); response.Amount.Should().Be(1m); response.ClientId.Should().Be(1); response.Note.Should().Be("A"); response.PetId.Should().Be(1); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.SalesPersonId.Should().Be(1); }
public void MapRequestToResponse() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties(1m, "A", "A", 1, 1, "A"); ApiSaleResponseModel response = mapper.MapRequestToResponse(1, model); response.Amount.Should().Be(1m); response.FirstName.Should().Be("A"); response.Id.Should().Be(1); response.LastName.Should().Be("A"); response.PaymentTypeId.Should().Be(1); response.PetId.Should().Be(1); response.Phone.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1); JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleRequestModel(); patch.ApplyTo(response); response.IpAddress.Should().Be("A"); response.Note.Should().Be("A"); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties(1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1); JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleRequestModel(); patch.ApplyTo(response); response.Amount.Should().Be(1m); response.ClientId.Should().Be(1); response.Note.Should().Be("A"); response.PetId.Should().Be(1); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.SalesPersonId.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiSaleModelMapper(); var model = new ApiSaleRequestModel(); model.SetProperties(1m, "A", "A", 1, 1, "A"); JsonPatchDocument <ApiSaleRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleRequestModel(); patch.ApplyTo(response); response.Amount.Should().Be(1m); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.PaymentTypeId.Should().Be(1); response.PetId.Should().Be(1); response.Phone.Should().Be("A"); }