Example #1
0
        public async void GetSimRunsForProject_ValidProjectId_ReturnsSimRunModelList()
        {
            // Arrange
            var projectId    = "623be379-ed40-49f3-bdd8-416f8cd0faa6";
            var httpService  = new HttpService(new HttpClient());
            var simRunClient = new SimRunClient(
                httpService
                );

            // Act
            var result = await simRunClient.GetSimRunsForProject(projectId);

            // Assert
            Assert.NotEmpty(result);
        }
        public async void GetSimRunsForProject_OkStatusCode_ReturnsSimRunModelList()
        {
            // Arrange
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(SimPlanModelDataMocks.MockSimPlanModelListJson)
            };
            var httpService = new Mock <IHttpService>();

            httpService
            .Setup(m => m.GetAsync(It.IsAny <string>()))
            .ReturnsAsync(httpResponseMessage);
            var simRunClient = new SimRunClient(httpService.Object);

            // Act
            var result = await simRunClient.GetSimRunsForProject(It.IsAny <string>());

            // Assert
            Assert.NotEmpty(result);
        }
        public async void GetSimRunsForProject_NotFoundStatusCode_ReturnsEmptyList()
        {
            // Arrange
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.NotFound,
                Content    = new StringContent("")
            };
            var httpService = new Mock <IHttpService>();

            httpService
            .Setup(m => m.GetAsync(It.IsAny <string>()))
            .ReturnsAsync(httpResponseMessage);
            var simRunClient = new SimRunClient(httpService.Object);

            // Act
            var result = await simRunClient.GetSimRunsForProject(It.IsAny <string>());

            // Assert
            Assert.Empty(result);
        }