Esempio n. 1
0
        public void loadFromAssembly_WhenAssemblyIsNull_ThrowNullArgumentException()
        {
            Assembly assembly   = null;
            var      typeLoader = new Kusnadi.Utils.TypeLoader();

            typeLoader.LoadFromAssembly(assembly);
        }
Esempio n. 2
0
        public void Types_WhenPassAssembly_ReturnCorrectTypes()
        {
            var assemblyMock = new Moq.Mock <_Assembly>();

            assemblyMock.Setup(item => item.GetTypes())
            .Returns(new Type[] { typeof(ClassA), typeof(ConcreteInterfaceA) });
            assemblyMock.Setup(item => item.GetObjectData(It.IsAny <SerializationInfo>(), It.IsAny <StreamingContext>()));

            var typeLoader = new Kusnadi.Utils.TypeLoader();

            typeLoader.LoadFromAssembly(assemblyMock.Object);
            IEnumerable <Type> types = typeLoader.Types;

            Assert.AreEqual(2, types.Count());
            Assert.IsTrue(types.Any(item => item.Equals(typeof(ClassA))));
            Assert.IsTrue(types.Any(item => item.Equals(typeof(ConcreteInterfaceA))));
        }