Exemplo n.º 1
0
        public void IsDerivedFrom_Should_FilterByTypePredicate_WhenTypeIsGeneric()
        {
            var classFilter = new FilteredClasses(CreateSampleClasses());
            var sut         = new ClassCondition(classFilter, false);

            _mockClass1.SetupGet(c => c.ClassType).Returns(typeof(ClassCondition));
            _mockClass2.SetupGet(c => c.ClassType).Returns(typeof(int));
            _mockClass3.SetupGet(c => c.ClassType).Returns(typeof(int));

            sut.IsDerivedFrom(typeof(TestCollectionBase <, , ,>));

            Assert.AreEqual(1, classFilter.FilteredItems.Count());
            Assert.IsTrue(classFilter.FilteredItems.Any(f => f.Name == "A"));
        }
Exemplo n.º 2
0
        public void IsDerivedFrom_Should_FilterByTypePredicate()
        {
            var classFilter = new FilteredClasses(CreateSampleClasses());
            var sut         = new ClassCondition(classFilter, false);

            _mockClass1.SetupGet(c => c.ClassType).Returns(typeof(SampleDerived));
            _mockClass2.SetupGet(c => c.ClassType).Returns(typeof(int));
            _mockClass3.SetupGet(c => c.ClassType).Returns(typeof(int));

            sut.IsDerivedFrom <SampleImplementation>();

            Assert.AreEqual(1, classFilter.FilteredItems.Count());
            Assert.IsTrue(classFilter.FilteredItems.Any(f => f.Name == "A"));
        }