Beispiel #1
0
        public void Init_InvalidAssemblyWithoutLinkedItems_ThrowsLinkerException(Assembly assembly)
        {
            var linkerStub = new TypeLinkerStub();
            var result     = Assert.Throws(typeof(LinkerException), () => linkerStub.Initialize(assembly));

            Assert.Equal("Type Links configured incorrectly. Cannot find Types for the all Keys.", result.Message);
        }
Beispiel #2
0
        public void Init_InvalidAssemblySeveralLinkedItemsForOneKey_ThrowsLinkerException()
        {
            var linkerStub = new TypeLinkerStub();
            var result     = Assert.Throws(typeof(LinkerException), () => linkerStub.Initialize(typeof(TypeLinkerInvalidSeveralLinkedItemsForOneKey).GetTypeInfo().Assembly));

            Assert.Equal($"Several types associated with the same Attribute - {LinkerKey.Item2}. Please verify configuration.", result.Message);
        }
Beispiel #3
0
        public void GetLinkedTypeByKey_ValidAssembly_ReturnsLinkedType()
        {
            var linkerStub = new TypeLinkerStub();

            linkerStub.Initialize(typeof(TypeLinkerValidConfiguration).GetTypeInfo().Assembly);
            var strategyType = linkerStub.GetLinkedType(LinkerKey.Item1);

            Assert.Equal(typeof(LinkedItem1), strategyType);
        }
Beispiel #4
0
        public void Init_ValidAssembly_InitializesTheLinker()
        {
            var linkerStub = new TypeLinkerStub();

            linkerStub.Initialize(typeof(TypeLinkerValidConfiguration).GetTypeInfo().Assembly);
        }