Ejemplo n.º 1
0
        private static IEnumerable <IReturnValueTransformer> DiscoverDefaultReturnValueTransformers()
        {
            Discoverer discoverer = new Discoverer(
                new AssemblyTypeContainer(typeof(SerializableLambdaInvoker).Assembly));

            return(discoverer.GetAll <IReturnValueTransformer>());
        }
Ejemplo n.º 2
0
        public void GetAll_ReturnsOnlyDefaultConstructable()
        {
            Type[] types = { typeof(NonDefaultConstructableFoo), typeof(Bar) };
            _typeContainerMock.Setup(container => container.GetTypes()).Returns(types);

            var subject = new Discoverer(_typeContainerMock.Object);

            Assert.AreEqual(1, subject.GetAll<IFoo>().Count());
        }
Ejemplo n.º 3
0
        public void GetAll_OnlyReturnsImplementingTypes()
        {
            Type[] types = { typeof(Bar), typeof(string), typeof(IDisposable) };
            _typeContainerMock.Setup(container => container.GetTypes()).Returns(types);

            var subject = new Discoverer(_typeContainerMock.Object);

            Assert.AreEqual(1, subject.GetAll<IFoo>().Count());
        }
Ejemplo n.º 4
0
        public void GetAll_SkipsInterfaces()
        {
            Type[] types = { typeof(IBar) };
            _typeContainerMock.Setup(container => container.GetTypes()).Returns(types);

            var subject = new Discoverer(_typeContainerMock.Object);

            Assert.IsEmpty(subject.GetAll <IFoo>());
        }
Ejemplo n.º 5
0
        public void GetAll_ReturnsOnlyDefaultConstructable()
        {
            Type[] types = { typeof(NonDefaultConstructableFoo), typeof(Bar) };
            _typeContainerMock.Setup(container => container.GetTypes()).Returns(types);

            var subject = new Discoverer(_typeContainerMock.Object);

            Assert.AreEqual(1, subject.GetAll <IFoo>().Count());
        }
Ejemplo n.º 6
0
        public void GetAll_OnlyReturnsImplementingTypes()
        {
            Type[] types = { typeof(Bar), typeof(string), typeof(IDisposable) };
            _typeContainerMock.Setup(container => container.GetTypes()).Returns(types);

            var subject = new Discoverer(_typeContainerMock.Object);

            Assert.AreEqual(1, subject.GetAll <IFoo>().Count());
        }
Ejemplo n.º 7
0
        public void GetAll_SkipsInterfaces()
        {
            Type[] types = { typeof(IBar) };
            _typeContainerMock.Setup(container => container.GetTypes()).Returns(types);

            var subject = new Discoverer(_typeContainerMock.Object);

            Assert.IsEmpty(subject.GetAll<IFoo>());
        }