public void CreateRootViewModel() { 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.CreateRootViewModel("MyProvider1", hasUnresolvedDependency: false); Assert.NotNull(result); Assert.Equal("ZzzDependencyRoot", result.Caption); Assert.Equal(KnownMonikers.AboutBox, result.Icon); }
public void DependenciesViewModelFactoryTests_CreateRootViewModel() { var project = UnconfiguredProjectFactory.Create(); var dependency = IDependencyFactory.FromJson(@" { ""ProviderType"": ""MyProvider1"", ""Id"": ""ZzzDependencyRoot"", ""Name"":""ZzzDependencyRoot"", ""Caption"":""ZzzDependencyRoot"" }", icon: KnownMonikers.AboutBox); var subTreeProvider1 = IProjectDependenciesSubTreeProviderFactory.Implement( providerType: "MyProvider1", createRootDependencyNode: dependency); var subTreeProvider2 = IProjectDependenciesSubTreeProviderFactory.Implement( providerType: "MyProvider2"); var factory = new TestableDependenciesViewModelFactory(project, new[] { subTreeProvider1, subTreeProvider2 }); var result = factory.CreateRootViewModel("MyProvider1", hasUnresolvedDependency: false); Assert.NotNull(result); Assert.Equal("ZzzDependencyRoot", result.Caption); Assert.Equal(KnownMonikers.AboutBox, result.Icon); }
public void CreateRootViewModelReturnsNullForUnknownProviderType() { var project = UnconfiguredProjectFactory.Create(); var subTreeProvider1 = IProjectDependenciesSubTreeProviderFactory.Implement(providerType: "MyProvider1"); var factory = new TestableDependenciesViewModelFactory(project, new[] { subTreeProvider1 }); var result = factory.CreateRootViewModel("UnknownProviderType", hasUnresolvedDependency: false); Assert.Null(result); }