Esempio n. 1
0
        public void Setup()
        {
            var assemblyReaderMock = new Mock <IAssemblyReader>();

            _sut = new ClassInfoCollector(assemblyReaderMock.Object);

            var           classToExamine = typeof(TestClass);
            IAssemblyInfo assembly       = new MarkUnitAssembly(classToExamine.Assembly);

            _classInfo = new MarkUnitClass(assembly, classToExamine);
        }
        public void IsDeclaredInAssemblyMatching_Should_FilterByPAttern()
        {
            var classFilter = new FilteredClasses(CreateSampleClasses());
            var sut         = new ClassCondition(classFilter, false);

            var sampleAssembly = new MarkUnitAssembly(GetType().Assembly);
            var otherAssembly  = new MarkUnitAssembly(typeof(List <>).Assembly);

            _mockClass1.SetupGet(c => c.AssemblyInfo).Returns(sampleAssembly);
            _mockClass2.SetupGet(c => c.AssemblyInfo).Returns(otherAssembly);
            _mockClass3.SetupGet(c => c.AssemblyInfo).Returns(otherAssembly);

            sut.IsDeclaredInAssemblyMatching("Tests.*");

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