public void MapResponseToRequest() { var mapper = new ApiQuoteTweetModelMapper(); var model = new ApiQuoteTweetResponseModel(); model.SetProperties(1, "A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, TimeSpan.Parse("0")); ApiQuoteTweetRequestModel response = mapper.MapResponseToRequest(model); response.Content.Should().Be("A"); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.RetweeterUserId.Should().Be(1); response.SourceTweetId.Should().Be(1); response.Time.Should().Be(TimeSpan.Parse("0")); }
public void CreatePatch() { var mapper = new ApiQuoteTweetModelMapper(); var model = new ApiQuoteTweetRequestModel(); model.SetProperties("A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, TimeSpan.Parse("0")); JsonPatchDocument <ApiQuoteTweetRequestModel> patch = mapper.CreatePatch(model); var response = new ApiQuoteTweetRequestModel(); patch.ApplyTo(response); response.Content.Should().Be("A"); response.Date.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM")); response.RetweeterUserId.Should().Be(1); response.SourceTweetId.Should().Be(1); response.Time.Should().Be(TimeSpan.Parse("0")); }
public async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); ApiQuoteTweetResponseModel model = await client.QuoteTweetGetAsync(1); ApiQuoteTweetModelMapper mapper = new ApiQuoteTweetModelMapper(); UpdateResponse <ApiQuoteTweetResponseModel> updateResponse = await client.QuoteTweetUpdateAsync(model.QuoteTweetId, mapper.MapResponseToRequest(model)); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); }