Пример #1
0
        public void ShouldNotStopLoadProcessAfterLoadCompleteByDefault()
        {
            // Given
            var mockLoaderFactory = new Mock <ICreateMDMLoader>();
            var loaderService     = new MDMDataLoaderService(mockLoaderFactory.Object);
            var testLoader        = new TestLoader();

            // When
            mockLoaderFactory.Setup(x => x.Create(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>())).Returns(testLoader);
            loaderService.Load(string.Empty, string.Empty, false);

            // Then
            testLoader.LoadCompletedHandlers.Should().Not.Contain("OnLoadCompleted");
        }
        public void ShouldStopLoadProcessAfterLoadCompleteIfRequested()
        {
            // Given
            var mockLoaderFactory = new Mock<ICreateMDMLoader>();
            var loaderService = new MDMDataLoaderService(mockLoaderFactory.Object);
            var testLoader = new TestLoader();

            // When
            mockLoaderFactory.Setup(x => x.Create(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(testLoader);
            loaderService.Load(string.Empty, string.Empty, false, canStopLoadProcessorOnLoadComplete: true);

            // Then
            testLoader.LoadCompletedHandlers.Should().Contain("OnLoadCompleted");
        }