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); }
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); }
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); }
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); }
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); }