public async void TestUpdate() { var model = await this.CreateRecord(); ApiStudioModelMapper mapper = new ApiStudioModelMapper(); UpdateResponse <ApiStudioResponseModel> updateResponse = await this.Client.StudioUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiStudioModelMapper(); var model = new ApiStudioResponseModel(); model.SetProperties(1, "A", "A", "A", "A", 1, "A", "A"); ApiStudioRequestModel response = mapper.MapResponseToRequest(model); response.Address1.Should().Be("A"); response.Address2.Should().Be("A"); response.City.Should().Be("A"); response.Name.Should().Be("A"); response.StateId.Should().Be(1); response.Website.Should().Be("A"); response.Zip.Should().Be("A"); }
public void MapClientResponseToRequest() { var mapper = new ApiStudioModelMapper(); var model = new ApiStudioClientResponseModel(); model.SetProperties(1, "A", "A", "A", "A", "A", "A", "A"); ApiStudioClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.Address1.Should().Be("A"); response.Address2.Should().Be("A"); response.City.Should().Be("A"); response.Name.Should().Be("A"); response.Province.Should().Be("A"); response.Website.Should().Be("A"); response.Zip.Should().Be("A"); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiStudioResponseModel model = await client.StudioGetAsync(1); ApiStudioModelMapper mapper = new ApiStudioModelMapper(); UpdateResponse <ApiStudioResponseModel> updateResponse = await client.StudioUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public void CreatePatch() { var mapper = new ApiStudioModelMapper(); var model = new ApiStudioRequestModel(); model.SetProperties("A", "A", "A", "A", 1, "A", "A"); JsonPatchDocument <ApiStudioRequestModel> patch = mapper.CreatePatch(model); var response = new ApiStudioRequestModel(); patch.ApplyTo(response); response.Address1.Should().Be("A"); response.Address2.Should().Be("A"); response.City.Should().Be("A"); response.Name.Should().Be("A"); response.StateId.Should().Be(1); response.Website.Should().Be("A"); response.Zip.Should().Be("A"); }