RunAsync_WithReleasePipelinesScope_GetDeploymentMethodsActivityAndReleasePipelinesOrchestratorShouldBeInvoked()
        {
            //Arrange
            var fixture = new Fixture();
            var mocks   = new MockRepository(MockBehavior.Strict);
            var starter = CreateStarter(fixture, mocks, RuleScopes.ReleasePipelines);

            //Act
            var fun = new ProjectScanOrchestrator();
            await fun.RunAsync(starter.Object);

            //Assert
            starter
            .Verify(x => x.CallSubOrchestratorAsync <object>(
                        nameof(GlobalPermissionsOrchestrator), It.IsAny <string>(),
                        It.IsAny <(Project, DateTime)>()), Times.Never);
            starter
            .Verify(x => x.CallSubOrchestratorAsync <object>(
                        nameof(ReleasePipelinesOrchestrator), It.IsAny <string>(),
                        It.IsAny <(Project, DateTime)>()), Times.Once);
            starter
            .Verify(x => x.CallSubOrchestratorAsync <object>(
                        nameof(BuildPipelinesOrchestrator), It.IsAny <string>(),
                        It.IsAny <(Project, DateTime)>()), Times.Never);
            starter
            .Verify(x => x.CallSubOrchestratorAsync <object>(
                        nameof(RepositoriesOrchestrator), It.IsAny <string>(),
                        It.IsAny <(Project, DateTime)>()), Times.Never);
        }
        public async Task RunAsync_WithoutScope_AllScopesShouldBeInvoked()
        {
            //Arrange
            var fixture = new Fixture();
            var mocks   = new MockRepository(MockBehavior.Strict);
            var starter = CreateStarter(fixture, mocks, null);

            //Act
            var fun = new ProjectScanOrchestrator();
            await fun.RunAsync(starter.Object);

            //Assert
            mocks.VerifyAll();
        }
        public async Task RunAsync_WithInvalidScope_NoScopesShouldBeInvoked()
        {
            //Arrange
            var fixture = new Fixture();
            var mocks   = new MockRepository(MockBehavior.Strict);

            var starter = mocks.Create <IDurableOrchestrationContext>();

            starter
            .Setup(x => x.GetInput <(Project, string, DateTime)>())
            .Returns((fixture.Create <Project>(), "unknownScope", fixture.Create <DateTime>()));

            starter
            .Setup(x => x.InstanceId)
            .Returns(fixture.Create <string>());

            //Act
            var fun = new ProjectScanOrchestrator();

            //Assert
            await Assert.ThrowsAsync <InvalidOperationException>(() => fun.RunAsync(starter.Object));
        }