コード例 #1
0
        public void CanGetMappedMethodTestWithWithouhtGenericArguments()
        {
            // Arrange
            Type[]        argTypes = new Type[] { typeof(double) };
            IInterfaceMap target   = CreateIInterfaceMap();

            target.Subject = new TestClass();
            const string name = "IntOverloaded";
            MappedMethod actual;

            // Act
            actual = target.GetMappedMethod <TestClass>(name, argTypes);
            int result = (int)actual(1D);

            // Assert
            Verify.That(result).IsEqualTo(TestClass.IntOverloadedDoubleReturn).Now();
        }
コード例 #2
0
        public void CanGetMappedMethodTestWithReturnType()
        {
            // Arrange
            IInterfaceMap target = CreateIInterfaceMap();

            target.Subject = new TestClass();
            string name = "IntOverloaded";

            Type[]             argTypes    = new Type[] { typeof(double) };
            Type[]             genericArgs = Type.EmptyTypes;
            MappedMethod <int> actual;

            // Act
            actual = target.GetMappedMethod <int, TestClass>(name, argTypes, genericArgs);

            // Assert
            Verify.That(actual(1.0)).IsEqualTo(TestClass.IntOverloadedDoubleReturn)
            .Now();
        }
コード例 #3
0
        public void CanGetMappedMethodTestWithoutReturnType()
        {
            // Arrange
            Type[]        argTypes    = new Type[] { typeof(float) };
            Type[]        genericArgs = new Type[] { typeof(float) };
            IInterfaceMap target      = CreateIInterfaceMap();

            target.Subject = new TestClass();
            const string name = "IntOverloaded";
            MappedMethod actual;

            // Act
            actual = target.GetMappedMethod <TestClass>(name, argTypes, genericArgs);

            // Assert
            int result = (int)actual(1F);

            Verify.That(result).IsEqualTo(TestClass.IntOverloadedGenericReturn).Now();
        }