public async void UnmarkSimPlan_MarkedSimPlanModel_NoExceptionThrown()
        {
            // Arrange
            var dependantResourceModel = new DependantResourceModel(
                ResourceTypeEnum.SimPlan,
                "5b07ddcf52e35100015f04e3"
                );
            var projectId     = "be69cb8c-45e4-4d80-8d55-419984aa2151";
            var httpService   = new HttpService(new HttpClient());
            var simPlanClient = new SimPlanClient(
                httpService
                );
            Exception exception = null;

            try
            {
                // Act
                await simPlanClient.UnmarkSimPlan(dependantResourceModel, projectId);
            }
            catch (Exception e)
            {
                exception = e;
            }

            // Assert
            Assert.Null(exception);
        }
Beispiel #2
0
        public async void DeleteResource_InternalServerErrorStatusCode_ThrowsException()
        {
            // Arrange
            var httpService         = new Mock <IHttpService>();
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.InternalServerError,
                Content    = new StringContent("")
            };

            httpService
            .Setup(m => m.GetAsync(It.IsAny <string>()))
            .ReturnsAsync(httpResponseMessage);
            var simPlanClient = new SimPlanClient(
                httpService.Object
                );
            Exception exception = null;

            try
            {
                // Act
                await simPlanClient.DeleteResource(
                    DependantResourceDataMocks.MockDependantResourceModel(),
                    It.IsAny <string>()
                    );
            }
            catch (FailedToGetResourceException e)
            {
                exception = e;
            }

            // Assert
            Assert.NotNull(exception);
        }
Beispiel #3
0
        public async void UnmarkSimPlan_OkStatusCode_NoExceptionThrown()
        {
            // Arrange
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(SimPlanModelDataMocks.MockMarkedSimPlanModelJson)
            };
            var httpService = new Mock <IHttpService>();

            httpService
            .Setup(m => m.GetAsync(It.IsAny <string>()))
            .ReturnsAsync(httpResponseMessage);
            httpService
            .Setup(m => m.PutAsync(It.IsAny <string>(), It.IsAny <SimPlanModel>()))
            .ReturnsAsync(httpResponseMessage);
            var       simPlanClient = new SimPlanClient(httpService.Object);
            Exception exception     = null;

            try
            {
                // Act
                await simPlanClient.UnmarkSimPlan(
                    DependantResourceDataMocks.MockDependantResourceModel(),
                    It.IsAny <string>()
                    );
            }
            catch (Exception e)
            {
                exception = e;
            }

            // Assert
            Assert.Null(exception);
        }
        public async void GetSimPlansForProject_ValidProjectId_ReturnsSimPlanModelList()
        {
            // Arrange
            var projectId     = "623be379-ed40-49f3-bdd8-416f8cd0faa6";
            var httpService   = new HttpService(new HttpClient());
            var simPlanClient = new SimPlanClient(
                httpService
                );

            // Act
            var result = await simPlanClient.GetSimPlansForProject(projectId);

            // Assert
            Assert.NotEmpty(result);
        }
        public async void MarkSimPlan_UnmarkedSimPlanModel_ReturnsDependantResourceModel()
        {
            // Arrange
            var simPlanId     = "5b06b85652e35100015f04db";
            var projectId     = "73fcb3bf-bc8b-4c8b-801f-8a90d92bf9c2";
            var httpService   = new HttpService(new HttpClient());
            var simPlanClient = new SimPlanClient(
                httpService
                );

            // Act
            var result = await simPlanClient.MarkSimPlan(simPlanId, projectId);

            // Assert
            Assert.NotNull(result);
        }
        public async void GetSimPlan_ValidSimPlanIdAndProjectId_ReturnsSimPlanModel()
        {
            // Arrange
            var simPlanId     = "5b06abe652e35100015f04d9";
            var projectId     = "623be379-ed40-49f3-bdd8-416f8cd0faa6";
            var httpService   = new HttpService(new HttpClient());
            var simPlanClient = new SimPlanClient(
                httpService
                );

            // Act
            var result = await simPlanClient.GetSimPlan(simPlanId, projectId);

            // Assert
            Assert.NotNull(result);
        }
Beispiel #7
0
        public async void GetSimPlansForScenario_OkStatusCode_ReturnsSimPlanModelList()
        {
            // 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 simPlanClient = new SimPlanClient(httpService.Object);

            // Act
            var result = await simPlanClient.GetSimPlansForScenario(It.IsAny <string>(), It.IsAny <string>());

            // Assert
            Assert.NotEmpty(result);
        }
Beispiel #8
0
        public async void MarkSimPlan_SimPlanModel_ReturnsDependantResourceModel()
        {
            // Arrange
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("")
            };
            var httpService = new Mock <IHttpService>();

            httpService
            .Setup(m => m.PutAsync(It.IsAny <string>(), It.IsAny <SimPlanModel>()))
            .ReturnsAsync(httpResponseMessage);
            var simPlanClient = new SimPlanClient(httpService.Object);

            // Act
            var result = await simPlanClient.MarkSimPlan(SimPlanModelDataMocks.MockSimPlanModel(), It.IsAny <string>());

            // Assert
            Assert.NotNull(result);
        }
Beispiel #9
0
        public async void GetSimPlansForProject_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 simPlanClient = new SimPlanClient(httpService.Object);

            // Act
            var result = await simPlanClient.GetSimPlansForProject(It.IsAny <string>());

            // Assert
            Assert.Empty(result);
        }