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

            httpService
            .Setup(m => m.PutAsync(It.IsAny <string>(), It.IsAny <SimRunMarkUpdateModel>()))
            .ReturnsAsync(httpResponseMessage);
            var       simRunClient = new SimRunClient(httpService.Object);
            Exception exception    = null;

            try
            {
                // Act
                await simRunClient.UnmarkSimRun(DependantResourceDataMocks.MockDependantResourceModel());
            }
            catch (Exception e)
            {
                exception = e;
            }

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

            httpService
            .Setup(m => m.PutAsync(It.IsAny <string>(), It.IsAny <SimRunMarkUpdateModel>()))
            .ReturnsAsync(httpResponseMessage);
            var       simRunClient = new SimRunClient(httpService.Object);
            Exception exception    = null;

            try
            {
                // Act
                await simRunClient.UnmarkSimRun(DependantResourceDataMocks.MockDependantResourceModel());
            }
            catch (FailedToUpdateResourceException e)
            {
                exception = e;
            }

            // Assert
            Assert.NotNull(exception);
        }
Пример #3
0
        public async void UnmarkSimRun_MarkedSimRunModel_NoExceptionThrown()
        {
            // Arrange
            var dependantResourceModel = new DependantResourceModel(
                ResourceTypeEnum.SimRun,
                "5b07ddd052e35100015f04e4"
                );
            var httpService  = new HttpService(new HttpClient());
            var simRunClient = new SimRunClient(
                httpService
                );
            Exception exception = null;

            try
            {
                // Act
                await simRunClient.UnmarkSimRun(dependantResourceModel);
            }
            catch (Exception e)
            {
                exception = e;
            }


            // Assert
            Assert.Null(exception);
        }