public void ShouldCreateExpenseReportFact() { new DatabaseTester().Clean(); var fact = new ExpenseReportFact() { Approver = "", Id = Guid.NewGuid(), Number = "1", Status = "Submitter", Submitter = "Me", TimeStamp = new DateTime(2015, 01, 01), Total = 123.456m, }; var command = new AddExpenseReportFactCommand(fact); var handler = new AddExpenseReportFactHandler(new StubbedDataContextFactory().GetContext()); handler.Handle(command); using (EfCoreContext context = new StubbedDataContextFactory().GetContext()) { context.Set <ExpenseReportFact>().Count().ShouldEqual(1); } }
public void ShouldCreateExpenseReportFact() { new DatabaseTester().Clean(); var fact = new ExpenseReportFact() { Approver = "", Id = Guid.NewGuid(), Number = "1", Status = "Submitter", Submitter = "Me", TimeStamp = new DateTime(2015, 01, 01), Total = 123.456m, }; var command = new AddExpenseReportFactCommand(fact); var handler = new AddExpenseReportFactHandler(); handler.Handle(command); using (ISession session = DataContext.GetTransactedSession()) { var facts = session.CreateCriteria <ExpenseReportFact>().List <ExpenseReportFact>(); Assert.That(facts.Count, Is.EqualTo(1)); } }
public void ShouldCreateExpenseReportFact() { new DatabaseTester().Clean(); var fact = new ExpenseReportFact() { Approver = "", Id = Guid.NewGuid(), Number = "1", Status = "Submitter", Submitter = "Me", TimeStamp = new DateTime(2015,01,01), Total = 123.456m, }; var command = new AddExpenseReportFactCommand(fact); var handler = new AddExpenseReportFactHandler(); handler.Handle(command); using (ISession session = DataContext.GetTransactedSession()) { var facts = session.CreateCriteria<ExpenseReportFact>().List<ExpenseReportFact>(); Assert.That(facts.Count, Is.EqualTo(1)); } }