public void CreateGroupNodeViewModel()
        {
            var project = UnconfiguredProjectFactory.Create();

            var dependencyModel = new TestDependencyModel
            {
                ProviderType     = "MyProvider1",
                Id               = "ZzzDependencyRoot",
                OriginalItemSpec = "ZzzDependencyRoot",
                Caption          = "ZzzDependencyRoot",
                Icon             = KnownMonikers.AboutBox
            };

            var subTreeProvider1 = IProjectDependenciesSubTreeProviderFactory.Implement(
                providerType: "MyProvider1",
                createRootDependencyNode: dependencyModel);
            var subTreeProvider2 = IProjectDependenciesSubTreeProviderFactory.Implement(
                providerType: "MyProvider2");

            var factory = new TestableDependenciesViewModelFactory(project, new[] { subTreeProvider1, subTreeProvider2 });

            var result = factory.CreateGroupNodeViewModel("MyProvider1", maximumDiagnosticLevel: DiagnosticLevel.None);

            Assert.NotNull(result);
            Assert.Equal("ZzzDependencyRoot", result !.Caption);
            Assert.Equal(KnownMonikers.AboutBox, result.Icon);
        }
Esempio n. 2
0
        public void CreateGroupNodeViewModel()
        {
            var project = UnconfiguredProjectFactory.Create();

            var dependencyModel = new TestDependencyModel
            {
                ProviderType = "MyProvider1",
                Id           = "ZzzDependencyRoot",
                Name         = "ZzzDependencyRoot",
                Caption      = "ZzzDependencyRoot",
                Icon         = KnownMonikers.AboutBox
            };

            var subTreeProvider1 = IProjectDependenciesSubTreeProviderFactory.Implement(
                providerType: "MyProvider1",
                createRootDependencyNode: dependencyModel);
            var subTreeProvider2 = IProjectDependenciesSubTreeProviderFactory.Implement(
                providerType: "MyProvider2");

            var factory = new TestableDependenciesViewModelFactory(project, new[] { subTreeProvider1, subTreeProvider2 });

            var result = factory.CreateGroupNodeViewModel("MyProvider1", hasVisibleUnresolvedDependency: false);

            Assert.NotNull(result);
            Assert.Equal("ZzzDependencyRoot", result !.Caption);
            Assert.Equal(KnownMonikers.AboutBox, result.Icon);
        }
        public void CreateGroupNodeViewModel_ReturnsNullForUnknownProviderType()
        {
            var project = UnconfiguredProjectFactory.Create();

            var subTreeProvider1 = IProjectDependenciesSubTreeProviderFactory.Implement(providerType: "MyProvider1");

            var factory = new TestableDependenciesViewModelFactory(project, new[] { subTreeProvider1 });

            var result = factory.CreateGroupNodeViewModel("UnknownProviderType", maximumDiagnosticLevel: DiagnosticLevel.None);

            Assert.Null(result);
        }
        public void CreateGroupNodeViewModel_ReturnsNullForUnknownProviderType()
        {
            var project = UnconfiguredProjectFactory.Create();

            var subTreeProvider1 = IProjectDependenciesSubTreeProviderFactory.Implement(providerType: "MyProvider1");

            var factory = new TestableDependenciesViewModelFactory(project, new[] { subTreeProvider1 });

            var result = factory.CreateGroupNodeViewModel("UnknownProviderType", hasVisibleUnresolvedDependency: false);

            Assert.Null(result);
        }