public async void TestUpdate() { var model = await this.CreateRecord(); ApiStoreModelMapper mapper = new ApiStoreModelMapper(); UpdateResponse <ApiStoreResponseModel> updateResponse = await this.Client.StoreUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiStoreModelMapper(); var model = new ApiStoreResponseModel(); model.SetProperties(1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1); ApiStoreRequestModel response = mapper.MapResponseToRequest(model); response.Demographic.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.SalesPersonID.Should().Be(1); }
public void CreatePatch() { var mapper = new ApiStoreModelMapper(); var model = new ApiStoreRequestModel(); model.SetProperties("A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), 1); JsonPatchDocument <ApiStoreRequestModel> patch = mapper.CreatePatch(model); var response = new ApiStoreRequestModel(); patch.ApplyTo(response); response.Demographic.Should().Be("A"); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.SalesPersonID.Should().Be(1); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiStoreResponseModel model = await client.StoreGetAsync(1); ApiStoreModelMapper mapper = new ApiStoreModelMapper(); UpdateResponse <ApiStoreResponseModel> updateResponse = await client.StoreUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }