コード例 #1
0
        public void AssemblyToExchangeModel()
        {
            var baseAssembly = AssemblyModelDataProvider.AssemblyTestV4;

            var(assembly, dependencies) = baseAssembly.ToExchangeModel();

            Assert.That.DeepEqual(AssemblyExchangeDataProvider.AssemblyTestV4(), assembly);
            Assert.AreEqual(0, dependencies.Count);
        }
コード例 #2
0
        public void ExchangeToAssemblyModel()
        {
            var assembly = AssemblyExchangeDataProvider.AssemblyTestV4();

            var dependencies = Array.Empty <AssemblyExchange>();

            var result = assembly.ToAssemblyModel(dependencies);

            Assert.That.DeepEqual(AssemblyModelDataProvider.AssemblyTestV4, result);
        }
コード例 #3
0
        public void ExchangeToAssemblyTwoSameVersion()
        {
            var assembly = AssemblyExchangeDataProvider.AnalyseBase();

            var dependencies = new[] {
                AssemblyExchangeDataProvider.AssemblyTestV4(),
                AssemblyExchangeDataProvider.AssemblyTestV4(),
            };

            assembly.AssembliesReferenced.AddRange(dependencies.Select(x => x.Name));

            Assert.ThrowsException <ArgumentException>(() => assembly.ToAssemblyModel(dependencies));
        }
コード例 #4
0
        public void ExchangeToAssemblyWithLink()
        {
            var assembly = AssemblyExchangeDataProvider.AnalyseBase();

            var dependencies = new[] {
                AssemblyExchangeDataProvider.AssemblyTestV4(),
            };

            assembly.AssembliesReferenced.AddRange(dependencies.Select(x => x.Name));

            var result = assembly.ToAssemblyModel(dependencies);

            Assert.AreEqual(1, result.ReferencedAssemblyNames.Count);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV4().Name, result.References[0].AssemblyFullName);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV4().Version, result.References[0].AssemblyVersion);
        }
コード例 #5
0
        public void ExchangeToInformationMissingVersion()
        {
            var assembly = AssemblyExchangeDataProvider.AnalyseBase();

            var dependencies = new[] {
                AssemblyExchangeDataProvider.AssemblyTestV4(),
            };

            assembly.AssembliesReferenced.Add(AssemblyExchangeDataProvider.AssemblyTestV2().Name);

            var result = assembly.ToAssemblyModel(dependencies);

            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV2().Name, result.References[0].AssemblyFullName);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV2().Version, result.References[0].AssemblyVersion);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV4().Version, result.References[0].LoadedAssembly.Version);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV4().Name, result.References[0].LoadedAssembly.FullName);
            Assert.AreEqual(true, result.References[0].LoadedAssembly.IsResolved);
        }
コード例 #6
0
        public void ExchangeToAssemblyismatchAndTwoVesions()
        {
            var assembly = AssemblyExchangeDataProvider.AnalyseBase();

            var dependencies = new[] {
                AssemblyExchangeDataProvider.AssemblyTestV4(),
                AssemblyExchangeDataProvider.AssemblyTestV2(),
            };

            assembly.AssembliesReferenced.Add(AssemblyExchangeDataProvider.AssemblyTestV2().Name);

            var result = assembly.ToAssemblyModel(dependencies);

            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV2().Name, result.References[0].AssemblyFullName);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV2().Version, result.References[0].AssemblyVersion);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV4().Version, result.References[0].LoadedAssembly.Version);
            Assert.AreEqual(AssemblyExchangeDataProvider.AssemblyTestV4().Name, result.References[0].LoadedAssembly.FullName);
        }