public void MapResponseToRequest() { var mapper = new ApiBucketModelMapper(); var model = new ApiBucketResponseModel(); model.SetProperties(1, Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A"); ApiBucketRequestModel response = mapper.MapResponseToRequest(model); response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiBucketModelMapper mapper = new ApiBucketModelMapper(); UpdateResponse <ApiBucketResponseModel> updateResponse = await this.Client.BucketUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiBucketModelMapper(); var model = new ApiBucketRequestModel(); model.SetProperties(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A"); JsonPatchDocument <ApiBucketRequestModel> patch = mapper.CreatePatch(model); var response = new ApiBucketRequestModel(); patch.ApplyTo(response); response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da")); response.Name.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()); ApiBucketResponseModel model = await client.BucketGetAsync(1); ApiBucketModelMapper mapper = new ApiBucketModelMapper(); UpdateResponse <ApiBucketResponseModel> updateResponse = await client.BucketUpdateAsync(model.Id, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }