コード例 #1
0
        public void IsPartialMatchWithHighestOverlap()
        {
            var first = new VersionedTypeFallback(
                new[]
            {
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(int).FullName, typeof(int).Assembly.GetName()),
                    new Version(2, 0)),
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(long).FullName, typeof(long).Assembly.GetName()),
                    new Version(2, 1)),
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(double).FullName, typeof(double).Assembly.GetName()),
                    new Version(2, 2)),
            });
            var second = new VersionedTypeFallback(
                new[]
            {
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(sbyte).FullName, typeof(sbyte).Assembly.GetName()),
                    new Version(1, 0)),
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(short).FullName, typeof(short).Assembly.GetName()),
                    new Version(1, 1)),
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(int).FullName, typeof(int).Assembly.GetName()),
                    new Version(1, 2)),
            });

            Assert.IsTrue(second.IsPartialMatch(first));
        }
コード例 #2
0
        public void IsPartialMatchWithNullReference()
        {
            var fallback = new VersionedTypeFallback(
                new[]
            {
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(int).FullName, typeof(int).Assembly.GetName()),
                    new Version(1, 0)),
            });

            Assert.IsFalse(fallback.IsPartialMatch(null));
        }
コード例 #3
0
        public void IsPartialMatchWithNoMatch()
        {
            var first = new VersionedTypeFallback(
                new[]
            {
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(int).FullName, typeof(int).Assembly.GetName()),
                    new Version(1, 0)),
            });
            var second = new VersionedTypeFallback(
                new[]
            {
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(double).FullName, typeof(int).Assembly.GetName()),
                    new Version(1, 0)),
            });

            Assert.IsFalse(first.IsPartialMatch(second));
        }