Example #1
0
        public void FromNamespaceContaining_T_ReturnsSelfAsFilter()
        {
            var subject = new DetectTypes();

            Assert.Same(
                subject,
                subject.FromNamespaceContaining<IService>());
        }
Example #2
0
        public void KnownTypes_GivenFromNamespaceContainingHasBeenCalled_ReturnsTypesInAssembly()
        {
            var subject = new DetectTypes();

            subject.FromNamespaceContaining<IService>();

            var ns = typeof(IService).Namespace;
            var expectedTypes = typeof(IService).Assembly.GetTypes().Where(type => type.Namespace == ns);
            var knownTypes = subject.KnownTypes();

            foreach (var type in expectedTypes)
                Assert.Contains(
                    type,
                    knownTypes);
        }