示例#1
0
        public void GetInValidHub()
        {
            var resolver      = new DefaultDependencyResolver();
            var hubManager    = new DefaultHubManager(resolver);
            var hubDescriptor = hubManager.GetHub("__ELLO__");

            Assert.Null(hubDescriptor);
        }
示例#2
0
        public void GetValidHub()
        {
            var resolver      = new DefaultDependencyResolver();
            var hubManager    = new DefaultHubManager(resolver);
            var hubDescriptor = hubManager.GetHub("CoreTestHub");

            Assert.NotNull(hubDescriptor);
            Assert.False(hubDescriptor.NameSpecified);
        }
        public void ShouldIgnoreCaseWhenDiscoveringHubsUsingManager()
        {
            var resolver = new DefaultDependencyResolver();
            var manager  = new DefaultHubManager(resolver);
            var hub      = manager.GetHub("hubwithoutattribute");

            Assert.NotNull(hub);
            Assert.Equal(hub.Name, "HubWithoutAttribute");
        }
        public void EnsureHubSuccessfullyResolves()
        {
            var resolver    = new DefaultDependencyResolver();
            var hubManager  = new DefaultHubManager(resolver);
            var TestHubName = "CoreTestHubWithMethod";

            HubDescriptor hub = null,
                          actualDescriptor = hubManager.GetHub(TestHubName);

            hub = hubManager.EnsureHub(TestHubName);
            Assert.Equal(hub, actualDescriptor);
        }
        public void GetInvalidHubThrows()
        {
            var hub = new HubDescriptor()
            {
                Name = "this.is.not.valid"
            };
            var resolver = new DefaultDependencyResolver();

            resolver.Register(typeof(IHubDescriptorProvider), () => new TestHubDescriptorProvider(hub));
            var hubManager = new DefaultHubManager(resolver);

            var ex = Assert.Throws <InvalidOperationException>(() => hubManager.GetHub(hub.Name));

            Assert.Equal(string.Format(Resources.Error_HubNameIsInvalid, hub.Name), ex.Message);
        }