Esempio n. 1
0
        public void WithReplacedSpec()
        {
            // Arrange
            var packageSpecA = new PackageSpec();

            packageSpecA.Title           = "A";
            packageSpecA.RestoreMetadata = new ProjectRestoreMetadata()
            {
                ProjectUniqueName = "a", CentralPackageVersionsEnabled = false
            };
            var dgSpec       = new DependencyGraphSpec();
            var packageSpecB = new PackageSpec();

            packageSpecB.Title           = "B";
            packageSpecB.RestoreMetadata = new ProjectRestoreMetadata()
            {
                ProjectUniqueName = "BBB"
            };
            var packageSpecC = new PackageSpec();

            packageSpecC.Title           = "C";
            packageSpecC.RestoreMetadata = new ProjectRestoreMetadata()
            {
                ProjectUniqueName = "CCC"
            };

            // Act
            dgSpec = dgSpec.WithReplacedSpec(packageSpecA);
            dgSpec = dgSpec.WithReplacedSpec(packageSpecB);
            dgSpec = dgSpec.WithReplacedSpec(packageSpecC);

            // Assert
            Assert.Equal(dgSpec.Projects.Count, 3);
            Assert.Equal(dgSpec.Restore.Count, 1);
        }