public void MapResponseToRequest() { var mapper = new ApiLocationModelMapper(); var model = new ApiLocationResponseModel(); model.SetProperties(1, 1, 1, "A"); ApiLocationRequestModel response = mapper.MapResponseToRequest(model); response.GpsLat.Should().Be(1); response.GpsLong.Should().Be(1); response.LocationName.Should().Be("A"); }
public void MapResponseToRequest() { var mapper = new ApiLocationModelMapper(); var model = new ApiLocationResponseModel(); model.SetProperties(1, 1, 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); ApiLocationRequestModel response = mapper.MapResponseToRequest(model); response.Availability.Should().Be(1); response.CostRate.Should().Be(1m); 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(); ApiLocationModelMapper mapper = new ApiLocationModelMapper(); UpdateResponse <ApiLocationResponseModel> updateResponse = await this.Client.LocationUpdateAsync(model.LocationID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void CreatePatch() { var mapper = new ApiLocationModelMapper(); var model = new ApiLocationRequestModel(); model.SetProperties(1, 1, "A"); JsonPatchDocument <ApiLocationRequestModel> patch = mapper.CreatePatch(model); var response = new ApiLocationRequestModel(); patch.ApplyTo(response); response.GpsLat.Should().Be(1); response.GpsLong.Should().Be(1); response.LocationName.Should().Be("A"); }
public void CreatePatch() { var mapper = new ApiLocationModelMapper(); var model = new ApiLocationRequestModel(); model.SetProperties(1, 1m, DateTime.Parse("1/1/1987 12:00:00 AM"), "A"); JsonPatchDocument <ApiLocationRequestModel> patch = mapper.CreatePatch(model); var response = new ApiLocationRequestModel(); patch.ApplyTo(response); response.Availability.Should().Be(1); response.CostRate.Should().Be(1m); 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()); ApiLocationResponseModel model = await client.LocationGetAsync(1); ApiLocationModelMapper mapper = new ApiLocationModelMapper(); UpdateResponse <ApiLocationResponseModel> updateResponse = await client.LocationUpdateAsync(model.LocationId, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }