Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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"));
        }
Exemplo n.º 7
0
        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"));
        }
Exemplo n.º 8
0
		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);
		}
Exemplo n.º 9
0
		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"));
		}
Exemplo n.º 10
0
		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"));
		}
Exemplo n.º 11
0
		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"));
		}
Exemplo n.º 12
0
		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);
		}
Exemplo n.º 13
0
		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"));
		}
Exemplo n.º 14
0
		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"));
		}