public void TestForThisAndActiveItemsFilter() { using (var container = new RhetosTestContainer()) { container.Resolve <ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt;", }); var e1ID = Guid.NewGuid(); var repository = container.Resolve <Common.DomRepository>(); var entity = new BasicEnt { ID = e1ID, Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; var entity3 = new BasicEnt { Name = "ttt3", Active = false }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2, entity3 }); Assert.AreEqual(1, repository.TestDeactivatable.BasicEnt.Query(new ActiveItems()).Count()); Assert.AreEqual(2, repository.TestDeactivatable.BasicEnt.Query(new ActiveItems { ItemID = e1ID }).Count()); } }
public void ActivePropertyValueDoesNotHaveToBeDefinedOnUpdate() { using (var container = new RhetosTestContainer()) { var id1 = Guid.NewGuid(); var id2 = Guid.NewGuid(); var id3 = Guid.NewGuid(); container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name) VALUES (" + SqlUtility.QuoteGuid(id1) + ", 'a')", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name, Active) VALUES (" + SqlUtility.QuoteGuid(id2) + ", 'b', 0)", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name) VALUES (" + SqlUtility.QuoteGuid(id3) + ", 'c')" }); var repository = container.Resolve<Common.DomRepository>(); var e1 = new BasicEnt { ID = id1, Name = "a2", Active = false }; var e2 = new BasicEnt { ID = id2, Name = "b2" }; var e3 = new BasicEnt { ID = id3, Name = "c2" }; repository.TestDeactivatable.BasicEnt.Update(new[] { e1, e2, e3}); var afterUpdate = repository.TestDeactivatable.BasicEnt.All(); Assert.AreEqual( "a2 False, b2 False, c2 True", TestUtility.DumpSorted(afterUpdate, item => item.Name + " " + item.Active)); } }
public void ActivePropertyValueDoesNotHaveToBeDefinedOnInsert() { using (var container = new RhetosTestContainer()) { container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt" }); var repository = container.Resolve<Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt" }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity }); Assert.AreEqual(true, repository.TestDeactivatable.BasicEnt.All().Single().Active); } }
public void ActivePropertyValueDoesNotHaveToBeDefinedOnInsert() { using (var executionContext = new CommonTestExecutionContext()) { executionContext.SqlExecuter.ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt" }); var repository = new Common.DomRepository(executionContext); var entity = new BasicEnt { Name = "ttt" }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity }); Assert.AreEqual(true, repository.TestDeactivatable.BasicEnt.All().Single().Active); } }
public void ItIsOkToInsertInactiveOrActiveItem() { using (var container = new RhetosTestContainer()) { var repository = container.Resolve <Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); } }
public void ItIsOkToInsertInactiveOrActiveItem() { using (var scope = TestScope.Create()) { var repository = scope.Resolve <Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); } }
public void ActivePropertyValueDoesNotHaveToBeDefinedOnInsert() { using (var container = new RhetosTestContainer()) { container.Resolve <ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt" }); var repository = container.Resolve <Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt" }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity }); Assert.AreEqual(true, repository.TestDeactivatable.BasicEnt.Load().Single().Active); } }
public void TestForActiveItemsFilter() { using (var scope = TestScope.Create()) { scope.Resolve <ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt;", }); var repository = scope.Resolve <Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); Assert.AreEqual(1, repository.TestDeactivatable.BasicEnt.Query(new ActiveItems()).Count()); } }
public void ActivePropertyValueDoesNotHaveToBeDefinedOnUpdate() { using (var container = new RhetosTestContainer()) { var id1 = Guid.NewGuid(); var id2 = Guid.NewGuid(); var id3 = Guid.NewGuid(); var id4 = Guid.NewGuid(); container.Resolve <ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name) VALUES (" + SqlUtility.QuoteGuid(id1) + ", 'a')", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name, Active) VALUES (" + SqlUtility.QuoteGuid(id2) + ", 'b', 0)", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name) VALUES (" + SqlUtility.QuoteGuid(id3) + ", 'c')", "INSERT INTO TestDeactivatable.BasicEnt (ID, Name, Active) VALUES (" + SqlUtility.QuoteGuid(id4) + ", 'd', 1)", }); var repository = container.Resolve <Common.DomRepository>(); Assert.AreEqual( "a , b False, c , d True", TestUtility.DumpSorted(repository.TestDeactivatable.BasicEnt.Query(), item => item.Name + " " + item.Active)); var e1 = new BasicEnt { ID = id1, Name = "a2", Active = false }; var e2 = new BasicEnt { ID = id2, Name = "b2" }; var e3 = new BasicEnt { ID = id3, Name = "c2" }; var e4 = new BasicEnt { ID = id4, Name = "d2" }; repository.TestDeactivatable.BasicEnt.Update(new[] { e1, e2, e3, e4 }); var afterUpdate = repository.TestDeactivatable.BasicEnt.Query(); Assert.AreEqual( "a2 False, b2 False, c2 True, d2 True", TestUtility.DumpSorted(afterUpdate, item => item.Name + " " + item.Active)); } }
public void TestForActiveItemsFilter() { using (var container = new RhetosTestContainer()) { container.Resolve<ISqlExecuter>().ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt;", }); var repository = container.Resolve<Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); Assert.AreEqual(1, repository.TestDeactivatable.BasicEnt.Filter(new ActiveItems()).Count()); } }
public void ItIsOkToInsertInactiveOrActiveItem() { using (var container = new RhetosTestContainer()) { var repository = container.Resolve<Common.DomRepository>(); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); } }
public void TestForActiveItemsFilter() { using (var executionContext = new CommonTestExecutionContext()) { executionContext.SqlExecuter.ExecuteSql(new[] { "DELETE FROM TestDeactivatable.BasicEnt;", }); var repository = new Common.DomRepository(executionContext); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); Assert.AreEqual(1, repository.TestDeactivatable.BasicEnt.Filter(new ActiveItems()).Count()); } }
public void ItIsOkToInsertInactiveOrActiveItem() { using (var executionContext = new CommonTestExecutionContext()) { var repository = new Common.DomRepository(executionContext); var entity = new BasicEnt { Name = "ttt", Active = false }; var entity2 = new BasicEnt { Name = "ttt2", Active = true }; repository.TestDeactivatable.BasicEnt.Insert(new[] { entity, entity2 }); } }