示例#1
0
        public async Task Then_The_Request_Is_Handled_And_The_Import_Locations_Called(
            ImportDataCommand command,
            [Frozen] Mock <ILocationImportService> importService,
            ImportDataCommandHandler handler)
        {
            await handler.Handle(command, It.IsAny <CancellationToken>());

            importService.Verify(x => x.Import(), Times.Once);
        }
示例#2
0
        public async Task Then_The_IndexBuilder_Is_Invoked(
            ImportDataCommand command,
            [Frozen] Mock <IIndexBuilder> indexBuilder,
            ImportDataCommandHandler handler
            )
        {
            // Act
            await handler.Handle(command, new CancellationToken());

            //Assert
            indexBuilder.Verify(x => x.Build(), Times.Once);
        }
示例#3
0
        public async Task Then_If_LarsData_Is_Not_Imported_Then_LarsData_Is_Not_Loaded(
            ImportDataCommand command,
            [Frozen] Mock <ILarsImportService> larsImportService,
            ImportDataCommandHandler handler
            )
        {
            //Arrange
            larsImportService.Setup(s => s.ImportDataIntoStaging()).ReturnsAsync((false, null));

            // Act
            await handler.Handle(command, new CancellationToken());

            //Assert
            larsImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>(), It.IsAny <string>()), Times.Never);
        }
示例#4
0
        public async Task Then_The_Services_Are_Called_To_Import_Data(
            ImportDataCommand command,
            [Frozen] Mock <IStandardsImportService> standardsImportService,
            [Frozen] Mock <ILarsImportService> larsImportService,
            [Frozen] Mock <IFrameworksImportService> frameworksImportService,
            ImportDataCommandHandler handler)
        {
            // Act
            await handler.Handle(command, new CancellationToken());

            //Assert

            larsImportService.Verify(x => x.ImportDataIntoStaging(), Times.Once);
            frameworksImportService.Verify(x => x.ImportDataIntoStaging(), Times.Once);
            standardsImportService.Verify(x => x.ImportDataIntoStaging(), Times.Once);
        }
        public async Task Then_The_Service_Is_Called_To_Import_Data(
            ImportDataCommand command,
            [Frozen] Mock <IProviderCourseImportService> providerStandardsImportService,
            [Frozen] Mock <INationalAchievementRatesImportService> nationalAchievementRatesImportService,
            [Frozen] Mock <INationalAchievementRatesOverallImportService> nationalAchievementRatesOverallImportService,
            [Frozen] Mock <IProviderRegistrationImportService> providerRegistrationImportService,
            [Frozen] Mock <IProviderRegistrationAddressImportService> providerRegistrationAddressImportService,
            ImportDataCommandHandler handler)
        {
            // Act
            await handler.Handle(command, new CancellationToken());

            //Assert
            providerStandardsImportService.Verify(x => x.ImportProviderCourses(), Times.Once);
            nationalAchievementRatesImportService.Verify(x => x.ImportData(), Times.Once);
            nationalAchievementRatesOverallImportService.Verify(x => x.ImportData(), Times.Once);
            providerRegistrationImportService.Verify(x => x.ImportData(), Times.Once);
            providerRegistrationAddressImportService.Verify(x => x.ImportAddressData(), Times.Once);
        }
示例#6
0
        public async Task Then_The_Services_Are_Called_To_Load_Data_From_Staging(
            ImportDataCommand command,
            string frameworkFile,
            string larsFile,
            [Frozen] Mock <IStandardsImportService> standardsImportService,
            [Frozen] Mock <ILarsImportService> larsImportService,
            [Frozen] Mock <IFrameworksImportService> frameworksImportService,
            [Frozen] Mock <IIndexBuilder> indexBuilder,
            ImportDataCommandHandler handler
            )
        {
            frameworksImportService.Setup(s => s.ImportDataIntoStaging()).ReturnsAsync((true, frameworkFile));
            larsImportService.Setup(s => s.ImportDataIntoStaging()).ReturnsAsync((true, larsFile));
            // Act
            await handler.Handle(command, new CancellationToken());

            //Assert
            larsImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>(), larsFile), Times.Once);
            frameworksImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>(), frameworkFile), Times.Once);
            standardsImportService.Verify(x => x.LoadDataFromStaging(It.IsAny <DateTime>()), Times.Once);
            indexBuilder.Verify(x => x.Build(), Times.Once);
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public LoadProjectsViewModel()
            : base("Load Projects")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Wait for decoding to be complete
            _eventWaitImport = new EventWaitHandle(false, EventResetMode.AutoReset);

            // Intialize values
            InitValues();

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.SelectedProjectVM, x => x.Value != null));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AdcpConfigurationView)));

            // Back coommand
            BackCommand = ReactiveCommand.Create();
            BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back)));

            // Exit coommand
            ExitCommand = ReactiveCommand.Create();
            ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            // Dialog to import data
            ImportDataCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsProjectLoading, x => !x.Value));
            ImportDataCommand.Subscribe(_ => ImportData());

            // Dialog to import RTB data
            ImportRtbDataCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsProjectLoading, x => !x.Value));
            ImportRtbDataCommand.Subscribe(_ => ImportRTB());

            // Scan for the projects
            Task.Run(() => ScanProjectAsync());
        }
 public CatalogCollection Get()
 {
     return(ImportDataCommand.GetCatalogs());
 }