public async Task BenchmarkApiShouldReturnCorrectModel() { // Arrange var expected = new TestPriceModel { Price = 5.63m, Date = new DateTime(2018, 1, 1, 0, 0, 0) }; // Act using (var response = await _client.GetAsync("api/prices/benchmark?portfolio=portfolio1&date=01%2F01%2F2018%2000%3A00%3A00")) { response.StatusCode.ShouldBe(HttpStatusCode.OK); var content = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <TestPriceModel>(content); result.Date.ShouldBe(expected.Date); result.Price.ShouldBe(expected.Price); } }
public async Task AverageApiShouldReturnCorrectModel2() { // Arrange var expected = new TestPriceModel { Price = 2.00m, Date = new DateTime(2018, 1, 1, 0, 0, 0) }; // Act using (var response = await _client.GetAsync("api/prices/average?portfolio=portfolio2&owner=owner1&instrument=instrument1&date=01%2F01%2F2018%2000%3A00%3A00")) { // Assert response.StatusCode.ShouldBe(HttpStatusCode.OK); var content = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <TestPriceModel>(content); result.Date.ShouldBe(expected.Date); result.Price.ShouldBe(expected.Price); } }