Exemplo n.º 1
0
        public void ShouldRaiseErrorIfThereIsNoLoaderForTheGivenEntity()
        {
            // Given
            var mockLoaderFactory = new Mock <ICreateMDMLoader>();
            var loaderService     = new MDMDataLoaderService(mockLoaderFactory.Object);

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

            // Then
            logger.Error.Should().Contain("Unable to create the MDM loader for the entity");
        }
        public void ShouldRaiseErrorIfThereIsNoLoaderForTheGivenEntity()
        {
            // Given
            var mockLoaderFactory = new Mock<ICreateMDMLoader>();
            var loaderService = new MDMDataLoaderService(mockLoaderFactory.Object);

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

            // Then
            logger.Error.Should().Contain("Unable to create the MDM loader for the entity");
        }
Exemplo n.º 3
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");
        }