示例#1
0
        public void AreSimilarContractWithSimilarTypesInDifferentAssemblies()
        {
            var first  = new OfflineTypeInformation(typeof(int).FullName, typeof(int).Assembly.GetName());
            var second = new OfflineTypeInformation(typeof(int).FullName, new AssemblyName(typeof(TestAttribute).Assembly.GetName().Name));

            Assert.IsFalse(first.AreSimilarContract(second));
        }
示例#2
0
        public void AreSimilarContractWithNullReference()
        {
            var type = typeof(int);
            var data = new OfflineTypeInformation(type.FullName, type.Assembly.GetName());

            Assert.IsFalse(data.AreSimilarContract(null));
        }
示例#3
0
        public void AreSimilarContractWithSimilarTypes()
        {
            var first  = new OfflineTypeInformation(typeof(int).FullName, typeof(int).Assembly.GetName());
            var second = new OfflineTypeInformation(typeof(int).FullName, new AssemblyName(typeof(int).Assembly.GetName().Name));

            Assert.IsTrue(first.AreSimilarContract(second));
        }
示例#4
0
        public void Create()
        {
            var type = typeof(int);
            var data = new OfflineTypeInformation(type.FullName, type.Assembly.GetName());

            Assert.AreSame(type.FullName, data.TypeFullName);
            Assert.AreEqual(type.Assembly.GetName().FullName, data.AssemblyName.FullName);
        }
示例#5
0
        public void HighestVersionMatchWithOverlap()
        {
            var firstType = new OfflineTypeInformation(typeof(long).FullName, typeof(long).Assembly.GetName());
            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>(
                    firstType,
                    new Version(2, 1)),
                new Tuple <OfflineTypeInformation, Version>(
                    new OfflineTypeInformation(typeof(double).FullName, typeof(double).Assembly.GetName()),
                    new Version(2, 2)),
            });

            var secondType = new OfflineTypeInformation(typeof(long).FullName, typeof(long).Assembly.GetName());
            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, 1)),
                new Tuple <OfflineTypeInformation, Version>(
                    secondType,
                    new Version(1, 2)),
            });

            var type = first.HighestVersionMatch(second);

            Assert.AreEqual(firstType, type);
        }