Example #1
0
        public void CastFailure_Sync()
        {
            var executor = new ProjectRebuildExecutor();
            var ex       = Assert.Throws <ServiceException>(() => executor.Process(new object()));

            ex.GetResult.Code.Should().Be(-3);
            ex.GetResult.Message.Should().Match("ProjectRebuildRequest cast failed.");
        }
Example #2
0
        public void CallsRebuildManager_Sync()
        {
            var mockManager = new Mock <ISiteModelRebuilderManager>();

            mockManager.Setup(x => x.Rebuild(It.IsAny <Guid>(), It.IsAny <bool>(), It.IsAny <TransferProxyType>())).Returns(true);

            DIBuilder
            .Continue()
            .Add(x => x.AddSingleton(mockManager.Object))
            .Complete();

            var executor = new ProjectRebuildExecutor(DIContext.Obtain <IConfigurationStore>(), DIContext.Obtain <ILoggerFactory>(), new Mock <IServiceExceptionHandler>().Object);

            executor.Process(new ProjectRebuildRequest(Guid.NewGuid(), TransferProxyType.TAGFiles, false));

            mockManager.Verify(x => x.Rebuild(It.IsAny <Guid>(), It.IsAny <bool>(), It.IsAny <TransferProxyType>()), Times.Once);
        }