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);
        }
Example #2
0
        public async void UnmarkSimPlan_InternalServerErrorStatusCode_ExceptionThrown()
        {
            // Arrange
            var httpResponseMessage = new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.InternalServerError,
                Content    = new StringContent("")
            };
            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 (FailedToGetResourceException e)
            {
                exception = e;
            }

            // Assert
            Assert.NotNull(exception);
        }