public bool SaveState(StateModel State) { if (NoSQLRepository.Count(state => state.Id == State.Id) > 0) { return(false); } return(NoSQLRepository.Save(State)); }
public void Count() { entityRepo.TruncateCollection(); Assert.AreEqual(0, entityRepo.Count(), "Repo should be empty"); var entity1 = TestHelper.GetEntity1(); entityRepo.InsertOne(entity1); Assert.AreEqual(1, entityRepo.Count(), "Repo should contain one element"); var entity2 = TestHelper.GetEntity2(); entityRepo.InsertOne(entity2); Assert.AreEqual(2, entityRepo.Count(), "Repo should contain two elements"); var entity3 = TestHelper.GetEntity3(); var entity4 = TestHelper.GetEntity4(); entityRepo.InsertMany(new List <TestEntity>() { entity3, entity4 }); Assert.AreEqual(4, entityRepo.Count(), "Repo should contain four elements"); }