public void ExecuteWithStaticHubMethod()
        {
            // Arrange
            DispatcherHub hub = new DispatcherHub();
            object[] parameters = new object[0];
            MethodInfo methodInfo = typeof(DispatcherHub).GetMethod("StaticHubMethod");
            HubMethodDispatcher dispatcher = new HubMethodDispatcher(methodInfo);

            // Act
            object returnValue = dispatcher.Execute(hub, parameters);

            // Assert
            var intResult = Assert.IsType<int>(returnValue);
            Assert.Equal(89, intResult);
        }
        public void ExecuteWithVoidHubMethod()
        {
            // Arrange
            DispatcherHub hub = new DispatcherHub();
            object[] parameters = new object[] { 5, "some string", new DateTime(2001, 1, 1) };
            MethodInfo methodInfo = typeof(DispatcherHub).GetMethod("VoidHubMethod");
            HubMethodDispatcher dispatcher = new HubMethodDispatcher(methodInfo);

            // Act
            object returnValue = dispatcher.Execute(hub, parameters);

            // Assert
            Assert.Null(returnValue);
            Assert.Equal(5, hub._i);
            Assert.Equal("some string", hub._s);
            Assert.Equal(new DateTime(2001, 1, 1), hub._dt);
        }
        public void ExecuteWithNormalHubMethod()
        {
            // Arrange
            DispatcherHub hub = new DispatcherHub();
            object[] parameters = new object[] { 5, "some string", new DateTime(2001, 1, 1) };
            MethodInfo methodInfo = typeof(DispatcherHub).GetMethod("NormalHubMethod");
            HubMethodDispatcher dispatcher = new HubMethodDispatcher(methodInfo);

            // Act
            object returnValue = dispatcher.Execute(hub, parameters);

            // Assert
            var stringResult = Assert.IsType<string>(returnValue);
            Assert.Equal("Hello from NormalHubMethod!", stringResult);

            Assert.Equal(5, hub._i);
            Assert.Equal("some string", hub._s);
            Assert.Equal(new DateTime(2001, 1, 1), hub._dt);
        }
        public void MethodInfoProperty()
        {
            // Arrange
            MethodInfo original = typeof(object).GetMethod("ToString");
            HubMethodDispatcher dispatcher = new HubMethodDispatcher(original);

            // Act
            MethodInfo returned = dispatcher.MethodInfo;

            // Assert
            Assert.Same(original, returned);
        }