public void CanCalculateHerdValue_v2() // TODO: REF { // Arrange decimal expectedTotal = 43300; decimal actualTotal; HerdService sut = new HerdService(TestContext.DbContextFactory); const int expectedDbOperations = 1; // Act TestContext.StartCollect(); // ------------------------------------- actualTotal = sut.CalculateTotalValue(); // ------------------------------------- var log = TestContext.EndCollect(); TestContext.Attach(log); // Assert Assert.Equal(expectedTotal, actualTotal); Assert.Equal(expectedDbOperations, GetLogEntryCount(log, LogCategories.EfDbCommand)); }
public void CanCalculateHerdValue_v1() // TODO: REF { // Arrange decimal expectedTotal = 43300; decimal? actualTotal = null; HerdService sut = new HerdService(TestContext.DbContextFactory); // Act var log = TestContext.Collect(() => { // ------------------------------------- actualTotal = sut.CalculateTotalValue(); // ------------------------------------- return(LogCollectorProvider.GetCorrelationId()); }); TestContext.Attach(log); // Assert Assert.Equal(expectedTotal, actualTotal); }