public async Task RunShouldCallOrchestratorFunctionOnceForEveryProject(int count)
        {
            //Arrange
            var projects = ProjectsTestHelper.CreateMultipleProjectsResponse(count).ToList();
            var orchestrationClientMock = new Mock <IDurableOrchestrationContext>();

            orchestrationClientMock.Setup(
                x => x.GetInput <List <Response.Project> >()).Returns(projects);

            //Act
            var fun = new ProjectScanSupervisor();
            await fun.RunAsync(orchestrationClientMock.Object);

            //Assert
            orchestrationClientMock.Verify(
                x => x.CallSubOrchestratorAsync <object>(nameof(ProjectScanOrchestrator), It.IsAny <string>(), It.IsAny <object>()),
                Times.Exactly(count));
        }
Пример #2
0
        public async Task RunShouldCallGetProjectsExactlyOnce()
        {
            //Arrange
            var orchestrationClientMock = new Mock <IDurableOrchestrationClient>();
            var clientMock    = new Mock <IVstsRestClient>();
            var timerInfoMock = CreateTimerInfoMock();

            var projects = ProjectsTestHelper.CreateMultipleProjectsResponse(1);

            clientMock.Setup(x => x.Get(It.IsAny <IEnumerableRequest <Response.Project> >()))
            .Returns(projects);

            //Act
            var fun = new ProjectScanStarter(clientMock.Object);
            await fun.RunAsync(timerInfoMock, orchestrationClientMock.Object);

            //Assert
            clientMock.Verify(x => x.Get(It.IsAny <IEnumerableRequest <Response.Project> >()), Times.Exactly(1));
        }