public void ReadJsonReturnedTypeNotNullTest() { //Arrange var testJson = BaseTests.GetTestJsonString(); //Act WeeklyAvailability result = JsonConvert.DeserializeObject <WeeklyAvailability>(testJson); //Assert Assert.IsNotNull(result); }
public void ReadJsonReturnedTypeCorrectFieldsTest() { //Arrange var testJson = BaseTests.GetTestJsonString(); //Act WeeklyAvailability result = JsonConvert.DeserializeObject <WeeklyAvailability>(testJson); //Assert Assert.AreEqual(result.FacilityId, "e9f7bd81-965d-4464-b607-999112b56022"); Assert.AreEqual(result.SlotDurationMinutes, 10); Assert.AreEqual(result.DaysAvailability.Count, 3); }
public async Task GetAsyncSuccessTest() { //Arrange StringContent testResponseContent = new StringContent(BaseTests.GetTestJsonString()); Mock <FakeHttpMessageHandler> httpMessageHandlerMock = new Mock <FakeHttpMessageHandler> { CallBase = true }; httpMessageHandlerMock.Setup(x => x.Send(It.IsAny <HttpRequestMessage>())).Returns(new HttpResponseMessage { StatusCode = System.Net.HttpStatusCode.OK, Content = testResponseContent }); _httpClientFactoryMock.Setup(x => x.Create(It.IsAny <string>(), It.IsAny <AuthenticationHeaderValue>())) .Returns(() => new HttpClient(httpMessageHandlerMock.Object)); //Act WeeklyAvailability result = await _slotHttpClient.GetAsync <WeeklyAvailability>("http://localhost:55670"); //Assert Assert.IsNotNull(result); }