public async Task GivenWeNeedToGenerateAssets_WhenWeDoSoThroughAConsoleInterface_ThenWeCallGenerateAssets(string arg1, string arg2) { //arrange var args = new string[] { arg1, arg2 }; //act await _classUnderTest.ProcessAsync(args).ConfigureAwait(false); //assert _mockGenerateAssetUseCase.Verify(s => s.ExecuteAsync(It.IsAny <GenerateAssetsRequest>(), It.IsAny <CancellationToken>()), Times.Once); }
static void Main(string[] args) { var assetRegister = new AssetRegister(); IConsoleGenerator generator = assetRegister.Get <IConsoleGenerator>(); generator.ProcessAsync(args).ConfigureAwait(false).GetAwaiter().GetResult(); }
public async Task GivenWeNeedToGenerateAssets_WhenWeDoSoThroughAConsoleInterface_ThenWeCanSearchForAssets(string arg1, string arg2) { //arrange var args = new string[] { arg1, arg2 }; //act using (var trans = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { var response = await _classUnderTest.ProcessAsync(args).ConfigureAwait(false); //assert for (int i = 0; i < response.Count; i++) { var generatedAsset = response.ElementAtOrDefault(i); var record = await FindAsset(generatedAsset, generatedAsset.AssetRegisterVersionId.Value); record.Should().NotBeNull(); record.AssetOutputModelIsEqual(generatedAsset); } trans.Dispose(); } }