Esempio n. 1
0
        public void Dependency_SetProperties()
        {
            var mockModel = IDependencyModelFactory.Implement(
                providerType: "providerType",
                id: "someId");

            var dependency = new Dependency(mockModel, ITargetFrameworkFactory.Implement("tfm1"), @"C:\Foo\Project.csproj");

            var newDependency = dependency.SetProperties(
                caption: "newcaption",
                resolved: true,
                flags: DependencyTreeFlags.BaseReferenceFlags,
                dependencyIDs: ImmutableArray.Create("aaa"));

            Assert.Equal("newcaption", newDependency.Caption);
            Assert.True(newDependency.Resolved);
            Assert.True(newDependency.Flags.Equals(DependencyTreeFlags.BaseReferenceFlags));
            Assert.Single(newDependency.DependencyIDs);
            Assert.Equal("aaa", newDependency.DependencyIDs[0]);
        }
Esempio n. 2
0
        public void Dependency_SetProperties()
        {
            var dependencyModel = new TestDependencyModel {
                ProviderType = "providerType", Id = "someId"
            };

            var dependency = new Dependency(dependencyModel, new TargetFramework("tfm1"), @"C:\Foo\Project.csproj");

            var newDependency = dependency.SetProperties(
                caption: "newcaption",
                resolved: true,
                flags: DependencyTreeFlags.BaseReferenceFlags,
                dependencyIDs: ImmutableArray.Create("aaa"));

            Assert.Equal("newcaption", newDependency.Caption);
            Assert.True(newDependency.Resolved);
            Assert.True(newDependency.Flags.Equals(DependencyTreeFlags.BaseReferenceFlags));
            Assert.Single(newDependency.DependencyIDs);
            Assert.Equal("aaa", newDependency.DependencyIDs[0]);
        }
Esempio n. 3
0
        public void Dependency_SetProperties_PreservesDependencyIDs()
        {
            var dependencyModel = new TestDependencyModel {
                ProviderType = "providerType", Id = "cube", DependencyIDs = ImmutableList <string> .Empty.Add("glass")
            };
            var dependency = new Dependency(dependencyModel, new TargetFramework("tfm1"), @"C:\Foo\Project.csproj");

            var expectedId           = "tfm1\\providerType\\cube";
            var expectedDependencyId = "tfm1\\providerType\\glass";

            Assert.Equal(expectedId, dependency.Id);
            Assert.Single(dependency.DependencyIDs);
            Assert.Equal(expectedDependencyId, dependency.DependencyIDs[0]);

            var newDependency = dependency.SetProperties(
                caption: "newcaption");

            Assert.Equal("newcaption", newDependency.Caption);

            Assert.Equal(expectedId, newDependency.Id);
            Assert.Single(newDependency.DependencyIDs);
            Assert.Equal(expectedDependencyId, newDependency.DependencyIDs[0]);
        }
Esempio n. 4
0
        public void Dependency_SetProperties_PreservesDependencyIDs()
        {
            var mockModel = IDependencyModelFactory.Implement(
                providerType: "providerType",
                id: "cube",
                dependencyIDs: ImmutableList <string> .Empty.Add("glass"));
            var dependency = new Dependency(mockModel, ITargetFrameworkFactory.Implement("tfm1"), @"C:\Foo\Project.csproj");

            var expectedId           = "tfm1\\providerType\\cube";
            var expectedDependencyId = "tfm1\\providerType\\glass";

            Assert.Equal(expectedId, dependency.Id);
            Assert.Single(dependency.DependencyIDs);
            Assert.Equal(expectedDependencyId, dependency.DependencyIDs[0]);

            var newDependency = dependency.SetProperties(
                caption: "newcaption");

            Assert.Equal("newcaption", newDependency.Caption);

            Assert.Equal(expectedId, newDependency.Id);
            Assert.Single(newDependency.DependencyIDs);
            Assert.Equal(expectedDependencyId, newDependency.DependencyIDs[0]);
        }