public void CanSetMoreFiltersThroughAction() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", f => f.Condition("condition1")); mapper.Filter("filter2", f => f.Condition("condition2")); hbm.filter.Length.Should().Be(2); hbm.filter.Satisfy(filters => filters.Any(f => f.name == "filter1" && f.condition == "condition1")); hbm.filter.Satisfy(filters => filters.Any(f => f.name == "filter2" && f.condition == "condition2")); }
public void CanSetMoreFiltersThroughAction() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", f => f.Condition("condition1")); mapper.Filter("filter2", f => f.Condition("condition2")); Assert.That(hbm.filter.Length, Is.EqualTo(2)); Assert.True(hbm.filter.Any(f => f.name == "filter1" && f.condition == "condition1")); Assert.True(hbm.filter.Any(f => f.name == "filter2" && f.condition == "condition2")); }
public void WhenSameNameThenOverrideCondition() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", f => f.Condition("condition1")); mapper.Filter("filter2", f => f.Condition("condition2")); mapper.Filter("filter1", f => f.Condition("anothercondition1")); Assert.That(hbm.filter.Length, Is.EqualTo(2)); Assert.That(hbm.filter.Any(f => f.name == "filter1" && f.condition == "anothercondition1"), Is.True); Assert.That(hbm.filter.Any(f => f.name == "filter2" && f.condition == "condition2"), Is.True); }
public void WhenSameNameThenOverrideCondition() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", f => f.Condition("condition1")); mapper.Filter("filter2", f => f.Condition("condition2")); mapper.Filter("filter1", f => f.Condition("anothercondition1")); hbm.filter.Length.Should().Be(2); hbm.filter.Satisfy(filters => filters.Any(f => f.name == "filter1" && f.condition == "anothercondition1")); hbm.filter.Satisfy(filters => filters.Any(f => f.name == "filter2" && f.condition == "condition2")); }
public void WhenActionIsNullThenAddFilterName() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", null); hbm.filter.Length.Should().Be(1); hbm.filter[0].Satisfy(f => f.name == "filter1" && f.condition == null); }
public void CanSetAFilterThroughAction() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", f => f.Condition("condition1")); Assert.That(hbm.filter.Length, Is.EqualTo(1)); Assert.That(hbm.filter[0].condition, Is.EqualTo("condition1")); Assert.That(hbm.filter[0].name, Is.EqualTo("filter1")); }
public void WhenActionIsNullThenAddFilterName() { var hbm = new HbmIdbag { name = "Children" }; var mapper = new IdBagMapper(typeof(Animal), typeof(Animal), hbm); mapper.Filter("filter1", null); Assert.That(hbm.filter.Length, Is.EqualTo(1)); var filter = hbm.filter[0]; Assert.That(filter.condition, Is.EqualTo(null)); Assert.That(filter.name, Is.EqualTo("filter1")); }