Exemple #1
0
        static void Main(string[] args)
        {
            var assetRegister = new AssetRegister();
            IConsoleImporter assetImporter = assetRegister.Get <IConsoleImporter>();

            assetImporter.ProcessAsync(args).ConfigureAwait(false).GetAwaiter().GetResult();
        }
Exemple #2
0
        public async Task GivenValidFilePathAndDemiliter_WhenWeCallProcess_ThenWeImportTheCsv(int expectedCount, string fileFlag, string fileValue, string delimiterFlag, string delimiterValue)
        {
            //arrange
            var directory = Directory.GetCurrentDirectory();
            var path      = Path.Combine(directory, "HomesEngland", "ConsoleImporter", fileValue);
            var args      = new[] { fileFlag, path, delimiterFlag, delimiterValue };

            //act
            using (var trans = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
            {
                var response = await _classUnderTest.ProcessAsync(args).ConfigureAwait(false);

                //assert
                response.Should().NotBeNullOrEmpty();
                response.Count.Should().Be(expectedCount);
                trans.Dispose();
            }
        }
Exemple #3
0
        public async Task GivenWeNeedToImportAssets_WhenWeDoSoThroughAConsoleInterface_ThenWeCallImportAssetsUseCase(string arg1, string arg2, string arg3, string arg4)
        {
            //arrange
            var args = new[] { arg1, arg2, arg3, arg4 };
            //act
            await _classUnderTest.ProcessAsync(args).ConfigureAwait(false);

            //assert
            _mockImportAssetUseCase.Verify(s => s.ExecuteAsync(It.IsAny <ImportAssetsRequest>(), It.IsAny <CancellationToken>()), Times.Once);
        }