// [Test] public void Seed() { var repository = new MongoDbUnitOfWorkRepository( CreateEmptyMongoDatabase(), new MongoUnitOfWorkExampleEventHandlers()); repository.Add(new SimpleAccount("Aimee", DateTime.Today.AddYears(-6), 30)); repository.Add(new SimpleAccount("John", DateTime.Today.AddYears(-46), 72)); repository.Add(new SimpleAccount("Isabelle", DateTime.Today.AddYears(-35), 60)); repository.Add(new SimpleAccount("Ellie2", DateTime.Today.AddYears(-12), 50)); var count = repository.Save(); count.ShouldEqual(4); }
// [Test] public void Seed() { var repository = new MongoDbUnitOfWorkRepository( CreateEmptyMongoDatabase(), new MongoUnitOfWorkExampleEventHandlers()); repository.Add(new SimpleAccount("Aimee", DateTime.Today.AddYears(-6), 30)); repository.Add(new SimpleAccount("John", DateTime.Today.AddYears(-46), 72)); repository.Add(new SimpleAccount("Isabelle", DateTime.Today.AddYears(-35), 60)); repository.Add(new SimpleAccount("Ellie2", DateTime.Today.AddYears(-12), 50)); var count = repository.Save(); count.ShouldEqual(4); }
// [Test] public void CheckAddAndDeleteFoMongoUnitOfWorkCommandRepository() { var eventRecorder = new RecordedRepositoryEvents(); var mongoDatabase = CreateEmptyMongoDatabase(); var repository = new MongoDbUnitOfWorkRepository(mongoDatabase, eventRecorder); var account = new SimpleAccount("xyz"); repository.GetEntities<SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(false); repository.Add(account); repository.GetEntities<SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(false); repository.Save(); repository.GetEntities<SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(true); repository.Delete(account); repository.GetEntities<SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(true); repository.Save(); repository.GetEntities<SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(false); }
// [Test] public void CheckAddAndDeleteFoMongoUnitOfWorkCommandRepository() { var eventRecorder = new RecordedRepositoryEvents(); var mongoDatabase = CreateEmptyMongoDatabase(); var repository = new MongoDbUnitOfWorkRepository(mongoDatabase, eventRecorder); var account = new SimpleAccount("xyz"); repository.GetEntities <SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(false); repository.Add(account); repository.GetEntities <SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(false); repository.Save(); repository.GetEntities <SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(true); repository.Delete(account); repository.GetEntities <SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(true); repository.Save(); repository.GetEntities <SimpleAccount>(p => p.Name == account.Name).Any().ShouldEqual(false); }