UnmarkResourcesForMarkSession_ProjectMarkSessionModel_ReturnsMarkSessionWithoutDependantResources() { // Arrange var markSessionModel = MarkSessionModelDataMocks.MockMarkSessionModel(); var markSessionRepository = new Mock <IMarkSessionRepository>(); var projectClient = new Mock <IProjectClient>(); var metadataClient = new Mock <IMetadataClient>(); var scenarioClient = new Mock <IScenarioClient>(); var resultConfigClient = new Mock <IResultConfigClient>(); var simPlanClient = new Mock <ISimPlanClient>(); var simRunClient = new Mock <ISimRunClient>(); var resultDataClient = new Mock <IResultDataClient>(); var dependantResourceHandler = new DependantResourceHandler( projectClient.Object, markSessionRepository.Object, metadataClient.Object, scenarioClient.Object, resultConfigClient.Object, simPlanClient.Object, simRunClient.Object, resultDataClient.Object ); // Act await dependantResourceHandler.UnmarkResourcesForMarkSession(markSessionModel); // Assert Assert.Empty(markSessionModel.DependantResources); }
public async void DeleteDependantResourcesForMarkSession_MarkSessionModel_NoExceptionThrown() { // Arrange var fileClient = new Mock <IFileClient>(); fileClient .Setup(m => m.DeleteResource(It.IsAny <DependantResourceModel>())) .Returns(Task.CompletedTask); var scenarioClient = new Mock <IScenarioClient>(); scenarioClient .Setup(m => m.DeleteResource(It.IsAny <DependantResourceModel>())) .Returns(Task.CompletedTask); var resultConfigClient = new Mock <IResultConfigClient>(); resultConfigClient .Setup(m => m.DeleteResource(It.IsAny <DependantResourceModel>())) .Returns(Task.CompletedTask); var simPlanClient = new Mock <ISimPlanClient>(); simPlanClient .Setup(m => m.DeleteResource(It.IsAny <DependantResourceModel>(), It.IsAny <string>())) .Returns(Task.CompletedTask); var simRunClient = new Mock <ISimRunClient>(); simRunClient .Setup(m => m.DeleteResource(It.IsAny <DependantResourceModel>(), It.IsAny <string>())) .Returns(Task.CompletedTask); var resultDataClient = new Mock <IResultDataClient>(); resultDataClient .Setup(m => m.DeleteResource(It.IsAny <DependantResourceModel>())) .Returns(Task.CompletedTask); var dependantResourceHandler = new DependantResourceHandler( fileClient.Object, scenarioClient.Object, resultConfigClient.Object, simPlanClient.Object, simRunClient.Object, resultDataClient.Object ); Exception exception = null; try { // Act await dependantResourceHandler.DeleteDependantResourcesForMarkSession( MarkSessionModelDataMocks.MockMarkSessionModel() ); } catch (Exception e) { exception = e; } // Assert Assert.Null(exception); }
public async void MarkResourcesForMarkSession_ProjectMarkSessionModel_ReturnsMarkSessionWithDependantResources() { // Arrange var emptyMarkSessionModel = MarkSessionModelDataMocks.MockMarkSessionModel(); emptyMarkSessionModel.DependantResources = new List <DependantResourceModel>(); var markSessionRepository = new Mock <IMarkSessionRepository>(); var projectClient = new Mock <IProjectClient>(); var metadataClient = new Mock <IMetadataClient>(); metadataClient .Setup(m => m.GetMetadataForProject(It.IsAny <string>())) .ReturnsAsync(MetadataModelDataMocks.MockFinishedMetadataModelList); metadataClient .Setup(m => m.MarkMetadata(It.IsAny <MetadataModel>())) .ReturnsAsync(DependantResourceDataMocks.MockDependantResourceModel); var scenarioClient = new Mock <IScenarioClient>(); var resultConfigClient = new Mock <IResultConfigClient>(); resultConfigClient .Setup(m => m.GetResultConfigsForMetadata(It.IsAny <string>())) .ReturnsAsync(new List <ResultConfigModel>()); var simPlanClient = new Mock <ISimPlanClient>(); var simRunClient = new Mock <ISimRunClient>(); var resultDataClient = new Mock <IResultDataClient>(); var dependantResourceHandler = new DependantResourceHandler( projectClient.Object, markSessionRepository.Object, metadataClient.Object, scenarioClient.Object, resultConfigClient.Object, simPlanClient.Object, simRunClient.Object, resultDataClient.Object ); // Act await dependantResourceHandler.MarkResourcesForMarkSession(emptyMarkSessionModel); // Assert Assert.NotEmpty(emptyMarkSessionModel.DependantResources); }