public async void MarkSimRun_MarkedSimRunModel_ThrowsException()
        {
            // 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 <SimRunModel>()))
            .ReturnsAsync(httpResponseMessage);
            var       simRunClient = new SimRunClient(httpService.Object);
            Exception exception    = null;

            try
            {
                // Act
                await simRunClient.MarkSimRun(It.IsAny <string>(), It.IsAny <string>());
            }
            catch (ResourceAlreadyMarkedException e)
            {
                exception = e;
            }

            // Assert
            Assert.NotNull(exception);
        }
Esempio n. 2
0
        public async void MarkSimRun_UnmarkedSimRunModel_ReturnsDependantResourceModel()
        {
            // Arrange
            var simRunId     = "5b06b85752e35100015f04dc";
            var projectId    = "73fcb3bf-bc8b-4c8b-801f-8a90d92bf9c2";
            var httpService  = new HttpService(new HttpClient());
            var simRunClient = new SimRunClient(
                httpService
                );

            // Act
            var result = await simRunClient.MarkSimRun(simRunId, projectId);

            // Assert
            Assert.NotNull(result);
        }
        public async void MarkSimRun_SimRunModel_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 <SimRunMarkUpdateModel>()))
            .ReturnsAsync(httpResponseMessage);
            var simRunClient = new SimRunClient(httpService.Object);

            // Act
            var result = await simRunClient.MarkSimRun(SimRunModelDataMocks.MockSimRunModel(), It.IsAny <string>());

            // Assert
            Assert.NotNull(result);
        }