Exemplo n.º 1
0
        private async Task ReloadInitializedCoverage(params ICoverageProject[] coverageProjects)
        {
            var projectsFromTask             = Task.FromResult(coverageProjects.ToList());
            var mockInitializeStatusProvider = new Mock <IInitializeStatusProvider>();

            mockInitializeStatusProvider.Setup(i => i.InitializeStatus).Returns(InitializeStatus.Initialized);
            fccEngine.Initialize(mockInitializeStatusProvider.Object);
            fccEngine.ReloadCoverage(() => projectsFromTask);
            await fccEngine.reloadCoverageTask;
        }
        internal TestContainerDiscoverer
        (
            [Import(typeof(IOperationState))]
            IOperationState operationState,

            [Import(typeof(SVsServiceProvider))]
            IServiceProvider serviceProvider
        )
        {
            _serviceProvider = serviceProvider;

            new Thread(() =>
            {
                try
                {
                    Logger.Initialize(_serviceProvider);

                    FCCEngine.Initialize();
                    Initialize(_serviceProvider);
                    TestContainersUpdated.ToString();
                    operationState.StateChanged += OperationState_StateChanged;

                    Logger.Log($"Initialized");
                }
                catch (Exception exception)
                {
                    Logger.Log($"Failed Initialization", exception);
                }
            }).Start();
        }
Exemplo n.º 3
0
        public void Should_Initialize_AppFolder_Then_Utils()
        {
            var        disposalToken = CancellationToken.None;
            List <int> callOrder     = new List <int>();

            var appDataFolderPath = "some path";
            var mockAppDataFolder = mocker.GetMock <IAppDataFolder>();

            mockAppDataFolder.Setup(appDataFolder => appDataFolder.Initialize(disposalToken)).Callback(() => callOrder.Add(1));
            mockAppDataFolder.Setup(appDataFolder => appDataFolder.DirectoryPath).Returns(appDataFolderPath);

            var reportGeneratorMock = mocker.GetMock <IReportGeneratorUtil>().Setup(reportGenerator => reportGenerator.Initialize(appDataFolderPath, disposalToken)).Callback(() => callOrder.Add(2));

            var msTestPlatformMock = mocker.GetMock <IMsTestPlatformUtil>().Setup(msTestPlatform => msTestPlatform.Initialize(appDataFolderPath, disposalToken)).Callback(() => callOrder.Add(3));

            var openCoverMock = mocker.GetMock <ICoverageUtilManager>().Setup(openCover => openCover.Initialize(appDataFolderPath, disposalToken)).Callback(() => callOrder.Add(4));

            fccEngine.Initialize(null, disposalToken);

            Assert.AreEqual(4, callOrder.Count);
            Assert.AreEqual(1, callOrder[0]);
        }
Exemplo n.º 4
0
        public void Should_Initialize_AppFolder_Then_Utils()
        {
            List <int> callOrder = new List <int>();

            var appDataFolderPath = "some path";
            var mockAppDataFolder = mocker.GetMock <IAppDataFolder>();

            mockAppDataFolder.Setup(appDataFolder => appDataFolder.Initialize()).Callback(() => callOrder.Add(1));
            mockAppDataFolder.Setup(appDataFolder => appDataFolder.DirectoryPath).Returns(appDataFolderPath);

            var coverletMock = mocker.GetMock <ICoverletUtil>().Setup(coverlet => coverlet.Initialize(appDataFolderPath)).Callback(() => callOrder.Add(2));

            var reportGeneratorMock = mocker.GetMock <IReportGeneratorUtil>().Setup(reportGenerator => reportGenerator.Initialize(appDataFolderPath)).Callback(() => callOrder.Add(3));

            var msTestPlatformMock = mocker.GetMock <IMsTestPlatformUtil>().Setup(msTestPlatform => msTestPlatform.Initialize(appDataFolderPath)).Callback(() => callOrder.Add(4));

            var openCoverMock = mocker.GetMock <IOpenCoverUtil>().Setup(openCover => openCover.Initialize(appDataFolderPath)).Callback(() => callOrder.Add(5));

            fccEngine.Initialize(null);

            Assert.AreEqual(5, callOrder.Count);
            Assert.AreEqual(1, callOrder[0]);
        }
Exemplo n.º 5
0
        public async Task Should_Poll_For_Initialized()
        {
            var times          = 5;
            var initializeWait = 1000;

            fccEngine.InitializeWait = initializeWait;

            var mockInitializeStatusProvider = new Mock <IInitializeStatusProvider>();

            mockInitializeStatusProvider.SetupProperty(i => i.InitializeStatus);
            var initializeStatusProvider = mockInitializeStatusProvider.Object;

            fccEngine.Initialize(initializeStatusProvider, CancellationToken.None);

            fccEngine.ReloadCoverage(() => Task.FromResult(new List <ICoverageProject>()));
            await Task.Delay(times *initializeWait).ContinueWith(_ =>
            {
                initializeStatusProvider.InitializeStatus = InitializeStatus.Initialized;
            });

            await fccEngine.reloadCoverageTask;

            mocker.Verify <ILogger>(l => l.Log(fccEngine.GetLogReloadCoverageStatusMessage(ReloadCoverageStatus.Initializing)), Times.AtLeast(times));
        }