public void GetNormalizedName_ReturnsNormalizedName_ForExplicitlyImplementedMethod()
        {
            var service        = new ExplicitInterfaceImplementation();
            var normalizedName = service.GetType().GetRuntimeMethods().First().GetNormalizedName();

            Assert.Equal("Method", normalizedName);
        }
        public void ShouldCallHandleOnExplicitInterfaceImplementation()
        {
            var handler = new ExplicitInterfaceImplementation();

            Assert.IsFalse(handler.IsHandled);
            Test.Handler(handler).OnMessage <TestMessage>();
            Assert.IsTrue(handler.IsHandled);
        }
示例#3
0
        internal static void Execute()
        {
            var result = new ConsumeInterface()._sample.MyDelegate(50);

            Console.WriteLine($"Result From Delegate: {result}");

            // Will not be able to access implemented methods
            //new ExplicitInterfaceImplementation().MyMethod();

            ExplicitInterfaceImplementation exp = new ExplicitInterfaceImplementation();

            // Will not be able to access implemented method.
            //exp.MyMethod()

            ((IInterfaceA)exp).MyMethod();

            ((IInterfaceA) new ExplicitInterfaceImplementation()).MyMethod();
        }