public async void CheckPurchaseFullTest() { // InMemorySink.Instance.Dispose(); LogContext.PushProperty("TestFunction", "CheckPurchaseFullTest"); _Logger.Information("Start CheckPurchaseFullTest"); Application.Model.Procurment.Purchase _purchase = _dbContext.Purchase.FirstOrDefault(); UpdateMovementStatusCommand _updatePurchaseStatusCommand = new UpdateMovementStatusCommand { Id = _purchase.Id, SenderId = 0, PurchaseDetailId = null, PurchaseAction = PurchaseAction.paFullPost }; var result = await _mediator.Send(_updatePurchaseStatusCommand); await _dbContext.SaveChangesAsync(CancellationToken.None); _Logger.Information("End CheckPurchaseFullTest"); _Logger.Information(""); var i = await _dbContext.Inventory.ToListAsync(); var ic = await _dbContext.InventoryChange.ToListAsync(); Assert.Equal(6, i.Count()); }
public async void DDDTest() { var outtemplate = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] {Message}{NewLine}{Exception}"; /* * _Logger = new LoggerConfiguration() * .MinimumLevel.Verbose() * .WriteTo. * TestOutput(_testOutputHelper, Serilog.Events.LogEventLevel.Verbose, outputTemplate: outtemplate) * .CreateLogger(); */ _Logger.Information("Start DDDTest"); Application.Model.Procurment.Purchase _purchase = _dbContext.Purchase.FirstOrDefault(); UpdateMovementStatusCommand _updatePurchaseStatusCommand = new UpdateMovementStatusCommand { Id = _purchase.Id, SenderId = 0, PurchaseDetailId = null, PurchaseAction = PurchaseAction.paFullPost }; var result = await _mediator.Send(_updatePurchaseStatusCommand); _Logger.Information(""); await _dbContext.SaveChangesAsync(CancellationToken.None); _Logger.Information("End DDDTest"); _Logger.Information(""); var i = await _dbContext.Inventory.ToListAsync(); var ic = await _dbContext.InventoryChange.ToListAsync(); Assert.Equal(6, i.Count()); }
public async void CheckPurchaseQtyTest() { try { LogContext.PushProperty("TestFunction", "CheckPurchaseQtyTest"); _Logger.Information("Start CheckPurchaseQtyTest"); Application.Model.Procurment.Purchase _purchase = _dbContext.Purchase.FirstOrDefault(); UpdateMovementStatusCommand _updatePurchaseStatusCommand = new UpdateMovementStatusCommand { Id = _purchase.Id, SenderId = 0, PurchaseDetailId = null, PurchaseAction = PurchaseAction.paQtyPost }; var result = await _mediator.Send(_updatePurchaseStatusCommand); await _dbContext.SaveChangesAsync(CancellationToken.None); _Logger.Information("End CheckPurchaseQtyTest"); } catch (Exception ex) { _Logger.Error("{ErrorMessage}", ex.Message); _Logger.Error("{StackTrace}", ex.StackTrace); } var i = await _dbContext.Inventory.ToListAsync(); // var ic = await _dbContext.InventoryChange.ToListAsync(); Assert.Equal(6, i.Count()); }