コード例 #1
0
        public void RouteKey_WithAdditionalAssemblies()
        {
            // Arrange
            var key1 = new RouteKey(typeof(string).Assembly, new[] { typeof(ComponentBase).Assembly, GetType().Assembly });
            var key2 = new RouteKey(typeof(string).Assembly, new[] { typeof(ComponentBase).Assembly, GetType().Assembly });

            // Act & Assert
            Assert.Equal(key1.GetHashCode(), key2.GetHashCode());
            Assert.True(key1.Equals(key2));
        }
コード例 #2
0
        public void RouteKey_WithAdditionalAssemblies_DifferentAdditionalAssemblies()
        {
            // Arrange
            var key1 = new RouteKey(typeof(ComponentBase).Assembly, new[] { typeof(object).Assembly });
            var key2 = new RouteKey(typeof(ComponentBase).Assembly, new[] { GetType().Assembly, });

            // Act & Assert
            Assert.Equal(key1.GetHashCode(), key2.GetHashCode());
            Assert.False(key1.Equals(key2));
        }
コード例 #3
0
        public void RouteKey_DefaultAgainstNonDefault()
        {
            // Arrange
            var key1 = default(RouteKey);
            var key2 = new RouteKey(typeof(string).Assembly, null);

            // Act & Assert
            Assert.NotEqual(key1.GetHashCode(), key2.GetHashCode());
            Assert.False(key1.Equals(key2));
        }
コード例 #4
0
        public void RouteKey_WithNoAdditionalAssemblies_DifferentAssemblies()
        {
            // Arrange
            var key1 = new RouteKey(typeof(string).Assembly, null);
            var key2 = new RouteKey(typeof(ComponentBase).Assembly, null);

            // Act & Assert
            Assert.NotEqual(key1.GetHashCode(), key2.GetHashCode());
            Assert.False(key1.Equals(key2));
        }
コード例 #5
0
        public void RouteKey_WithNoAdditionalAssemblies_Equality()
        {
            // Arrange
            var key1 = new RouteKey(typeof(string).Assembly, null);
            var key2 = new RouteKey(typeof(string).Assembly, null);

            // Act & Assert
            Assert.Equal(key1.GetHashCode(), key2.GetHashCode());
            Assert.True(key1.Equals(key2));
        }
コード例 #6
0
ファイル: Router.cs プロジェクト: vchy1997/aspnetcore
        private void RefreshRouteTable()
        {
            var routeKey = new RouteKey(AppAssembly, AdditionalAssemblies);

            if (!routeKey.Equals(_routeTableLastBuiltForRouteKey))
            {
                _routeTableLastBuiltForRouteKey = routeKey;
                Routes = RouteTableFactory.Create(routeKey);
            }
        }
コード例 #7
0
ファイル: Router.cs プロジェクト: vchy1997/aspnetcore
 private void ClearRouteCaches()
 {
     RouteTableFactory.ClearCaches();
     _routeTableLastBuiltForRouteKey = default;
 }