public async void TestUpdate() { var model = await this.CreateRecord(); ApiDatabaseLogModelMapper mapper = new ApiDatabaseLogModelMapper(); UpdateResponse <ApiDatabaseLogResponseModel> updateResponse = await this.Client.DatabaseLogUpdateAsync(model.DatabaseLogID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); await this.Cleanup(); }
public void MapResponseToRequest() { var mapper = new ApiDatabaseLogModelMapper(); var model = new ApiDatabaseLogResponseModel(); model.SetProperties(1, "A", "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A"); ApiDatabaseLogRequestModel response = mapper.MapResponseToRequest(model); response.DatabaseUser.Should().Be("A"); [email protected]().Be("A"); [email protected]().Be("A"); response.PostTime.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Schema.Should().Be("A"); response.Tsql.Should().Be("A"); response.XmlEvent.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()); ApiDatabaseLogResponseModel model = await client.DatabaseLogGetAsync(1); ApiDatabaseLogModelMapper mapper = new ApiDatabaseLogModelMapper(); UpdateResponse <ApiDatabaseLogResponseModel> updateResponse = await client.DatabaseLogUpdateAsync(model.DatabaseLogID, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }
public void CreatePatch() { var mapper = new ApiDatabaseLogModelMapper(); var model = new ApiDatabaseLogRequestModel(); model.SetProperties("A", "A", "A", DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A"); JsonPatchDocument <ApiDatabaseLogRequestModel> patch = mapper.CreatePatch(model); var response = new ApiDatabaseLogRequestModel(); patch.ApplyTo(response); response.DatabaseUser.Should().Be("A"); [email protected]().Be("A"); [email protected]().Be("A"); response.PostTime.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.Schema.Should().Be("A"); response.Tsql.Should().Be("A"); response.XmlEvent.Should().Be("A"); }