public virtual async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ISaleService service = testServer.Host.Services.GetService(typeof(ISaleService)) as ISaleService; var model = new ApiSaleServerRequestModel(); model.SetProperties(2m, 2, "B", 1, DateTime.Parse("1/1/1988 12:00:00 AM"), 2); CreateResponse <ApiSaleServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.SaleDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiSaleServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
public void MapServerRequestToResponse() { var mapper = new ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM")); ApiSaleServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); response.CustomerId.Should().Be(1); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public void CreatePatch() { var mapper = new ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM")); JsonPatchDocument <ApiSaleServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleServerRequestModel(); patch.ApplyTo(response); response.CustomerId.Should().Be(1); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); }
public void MapServerRequestToResponse() { var mapper = new ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1); ApiSaleServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); response.IpAddress.Should().Be("A"); response.Notes.Should().Be("A"); response.SaleDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.TransactionId.Should().Be(1); }
public void MapServerRequestToResponse() { var mapper = new ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties(1m, 1, "A", 1, DateTime.Parse("1/1/1987 12:00:00 AM"), 1); ApiSaleServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); response.Amount.Should().Be(1m); response.CutomerId.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 MapServerRequestToResponse() { var mapper = new ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties(1m, "A", "A", 1, 1, "A"); ApiSaleServerResponseModel response = mapper.MapServerRequestToResponse(1, model); response.Should().NotBeNull(); 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 CreatePatch() { var mapper = new ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties("A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1); JsonPatchDocument <ApiSaleServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleServerRequestModel(); patch.ApplyTo(response); response.IpAddress.Should().Be("A"); response.Notes.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 ApiSaleServerModelMapper(); var model = new ApiSaleServerRequestModel(); model.SetProperties(1m, "A", "A", 1, 1, "A"); JsonPatchDocument <ApiSaleServerRequestModel> patch = mapper.CreatePatch(model); var response = new ApiSaleServerRequestModel(); 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"); }