public void MapResponseToRequest() { var mapper = new ApiPhoneNumberTypeModelMapper(); var model = new ApiPhoneNumberTypeResponseModel(); model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiPhoneNumberTypeRequestModel response = mapper.MapResponseToRequest(model); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Name.Should().Be("A"); }
public async void TestUpdate() { var model = await this.CreateRecord(); ApiPhoneNumberTypeModelMapper mapper = new ApiPhoneNumberTypeModelMapper(); UpdateResponse <ApiPhoneNumberTypeResponseModel> updateResponse = await this.Client.PhoneNumberTypeUpdateAsync(model.PhoneNumberTypeID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiPhoneNumberTypeModelMapper(); var model = new ApiPhoneNumberTypeRequestModel(); model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); JsonPatchDocument <ApiPhoneNumberTypeRequestModel> patch = mapper.CreatePatch(model); var response = new ApiPhoneNumberTypeRequestModel(); patch.ApplyTo(response); response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); 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()); ApiPhoneNumberTypeResponseModel model = await client.PhoneNumberTypeGetAsync(1); ApiPhoneNumberTypeModelMapper mapper = new ApiPhoneNumberTypeModelMapper(); UpdateResponse <ApiPhoneNumberTypeResponseModel> updateResponse = await client.PhoneNumberTypeUpdateAsync(model.PhoneNumberTypeID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }