Пример #1
0
 public void ExistsUniqueItem_Own_ReturnItem()
 {
     var repository = new MongoRepository<TestModel>();
     repository.Drop();
     var item = TestModel.CreateInstance();
     repository.Insert(item);
     item.IntValue = 5;
     var result = repository.ExistsUniqueItem(item);
     Assert.IsFalse(result);
 }
Пример #2
0
 public void ExistsUniqueItem_OnlySelf_ReturnNull()
 {
     var repository = new MongoRepository<TestModel>();
     repository.Drop();
     var item = new TestModel { StringValue = "sinan" };
     var item2 = new TestModel { StringValue = "sinan" };
     repository.Insert(item);
     var result = repository.ExistsUniqueItem(item2);
     Assert.IsTrue(result);
 }
Пример #3
0
 public void ExistsUniqueItem_SelfAndWithOtherProperties_ReturnNull()
 {
     var repository = new MongoRepository<TestModel3>();
     repository.Drop();
     var item = new TestModel3 { StringValue = "sinan", StringValue2 = "akyazıcı", DateTimeValue = DateTime.Parse("01/01/1967") };
     var item2 = new TestModel3 { StringValue = "sinan", StringValue2 = "akyazıcı", DateTimeValue = DateTime.Parse("01/01/1967") };
     repository.Insert(item);
     var result = repository.ExistsUniqueItem(item2);
     Assert.IsTrue(result);
 }
Пример #4
0
 public void ExistsUniqueItem_WithOutBsonUnique_ReturnItem()
 {
     var repository = new MongoRepository<TestModel4>();
     repository.Drop();
     var item = new TestModel4 { StringValue = "sinan", StringValue2 = "akyazıcı", DateTimeValue = DateTime.Parse("01/01/1967") };
     var item2 = new TestModel4 { StringValue = "sinan", StringValue2 = "akyazıcıx", DateTimeValue = DateTime.Parse("02/01/1967") };
     repository.Insert(item);
     var result = repository.ExistsUniqueItem(item2);
     Assert.IsFalse(result);
 }
Пример #5
0
 public void ExistsUniqueItem_WithOtherProperties_ReturnNull()
 {
     var repository = new MongoRepository<TestModel2>();
     repository.Drop();
     var item = new TestModel2 { StringValue = "sinan", StringValue2 = "akyazıcı", IntValue = 5 };
     var item2 = new TestModel2 { StringValue = "sinan", StringValue2 = "akyazıcı", IntValue = 5 };
     repository.Insert(item);
     var result = repository.ExistsUniqueItem(item2);
     Assert.IsTrue(result);
 }