Esempio n. 1
0
        public void Test_Operator_StartsWith()
        {
            TextFilterDescriptor descriptor = new TextFilterDescriptor();

            descriptor.Operator     = TextOperator.StartsWith;
            descriptor.Value        = "Sof";
            descriptor.MemberAccess = new CityMemberAccess();

            var viewModel = new TestViewModel()
            {
                City = "Sofia", Name = "Tsvyatko"
            };

            Assert.IsTrue(descriptor.PassesFilter(viewModel));

            descriptor.Value = "Soff";
            Assert.IsFalse(descriptor.PassesFilter(viewModel));
        }
Esempio n. 2
0
        public void Test_Operator_EqualsTo()
        {
            TextFilterDescriptor descriptor = new TextFilterDescriptor();

            descriptor.Operator     = TextOperator.EqualsTo;
            descriptor.Value        = "Sofia";
            descriptor.MemberAccess = new CityMemberAccess();

            var viewModel = new TestViewModel()
            {
                City = "Sofia", Name = "Tsvyatko"
            };

            Assert.IsTrue(descriptor.PassesFilter(viewModel));

            // test case-sensitivity
            viewModel.City = "sofia";
            Assert.IsFalse(descriptor.PassesFilter(viewModel));

            descriptor.IsCaseSensitive = false;
            Assert.IsTrue(descriptor.PassesFilter(viewModel));
        }
Esempio n. 3
0
        public void Test_Operator_DoesNotEqualTo()
        {
            TextFilterDescriptor descriptor = new TextFilterDescriptor();

            descriptor.Operator     = TextOperator.DoesNotEqualTo;
            descriptor.Value        = "Sofia";
            descriptor.MemberAccess = new CityMemberAccess();

            var viewModel = new TestViewModel()
            {
                City = "Sofia", Name = "Tsvyatko"
            };

            Assert.IsFalse(descriptor.PassesFilter(viewModel));
        }