public void HasConfiguration() { MockSolution solution = _serviceProvider.GetService(typeof(SVsSolution)) as MockSolution; MockIVsProject vsProject = new MockIVsProject("c:\\temp.proj"); solution.AddProject(vsProject); CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor accessor = new CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor(vsProject, _serviceProvider); Assert.IsFalse(accessor.HasConfiguration, "HasConfiguration was true for a new project."); accessor.CreateDefaultConfiguration(); Assert.IsTrue(accessor.HasConfiguration, "HasConfiguration was false after CreateDefaultConfiguration."); }
public void TermTables() { MockSolution solution = _serviceProvider.GetService(typeof(SVsSolution)) as MockSolution; MockIVsProject vsProject = new MockIVsProject("c:\\temp.proj"); solution.AddProject(vsProject); CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor accessor = new CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor(vsProject, _serviceProvider); Assert.AreEqual(0, accessor.TermTableFiles.Count, "TermTableFiles not initially empty."); accessor.CreateDefaultConfiguration(); Assert.AreEqual(1, accessor.TermTableFiles.Count, "TermTableFiles wrong size after CreateDefaultConfiguration."); MockDTE dte = _serviceProvider.GetService(typeof(DTE)) as MockDTE; MockDTEGlobals globals = dte.Solution.Projects.Item(0).Globals as MockDTEGlobals; globals.ClearNonPersistedVariables(); // Create a new proj config store to see if the change was persisted. CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor accessor2 = new CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor(vsProject, _serviceProvider); Assert.AreEqual(1, accessor2.TermTableFiles.Count, "CreateDefaultConfiguration changes did not persist."); accessor.TermTableFiles.Remove(Utilities.ListFromEnum(accessor.TermTableFiles)[0]); globals.ClearNonPersistedVariables(); // Create a new proj config store to see if the change was persisted. CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor accessor3 = new CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor(vsProject, _serviceProvider); Assert.AreEqual(0, accessor3.TermTableFiles.Count, "Deletion did not persist."); accessor.TermTableFiles.Add("c:\\foo"); accessor.TermTableFiles.Add("c:\\bar"); globals.ClearNonPersistedVariables(); // Create a new proj config store to see if the change was persisted. CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor accessor4 = new CodeSweep.VSPackage.NonMSBuildProjectConfigStore_Accessor(vsProject, _serviceProvider); Assert.AreEqual(2, accessor4.TermTableFiles.Count, "Additions did not persist."); }