/// <summary> /// Helper class to validate the cache contains what we expect it to /// contain after loading the real ServerClassLib project /// </summary> /// <param name="cache"></param> /// <param name="projectPath"></param> private void ValidateProjectSourceFileCache(ProjectSourceFileCache cache, string projectPath) { string serverProjectPath = CodeGenHelper.ServerClassLibProjectPath(projectPath); string server2ProjectPath = CodeGenHelper.ServerClassLib2ProjectPath(projectPath); string[] expectedServerFiles = new string[] { "TestEntity.shared.cs" }; string[] expectedServer2Files = new string[] { "ServerClassLib2.shared.cs" }; // Ask cache for all known projects. It should open the .csproj and find project references IEnumerable <string> projects = cache.GetAllKnownProjects(); Assert.IsNotNull(projects); // We expect to find ServerClassLib and ServerClassLib2 in the set of known projects. // There may be others due to normal project references, but we don't care about them Assert.IsTrue(projects.Contains(serverProjectPath), "Expected to find " + serverProjectPath + " in list of known projects"); Assert.IsTrue(projects.Contains(server2ProjectPath), "Expected to find " + server2ProjectPath + " in list of known projects"); IEnumerable <string> serverFiles = cache.GetSourceFilesInProject(serverProjectPath); Assert.IsNotNull(serverFiles); Assert.IsTrue(serverFiles.Count() >= expectedServerFiles.Length); foreach (string file in expectedServerFiles) { string expectedFile = Path.Combine(Path.GetDirectoryName(serverProjectPath), file); Assert.IsTrue(serverFiles.Contains(expectedFile), "Expected to see " + expectedFile + " in list of server files"); } IEnumerable <string> server2Files = cache.GetSourceFilesInProject(server2ProjectPath); Assert.IsNotNull(server2Files); Assert.IsTrue(server2Files.Count() >= expectedServer2Files.Length); foreach (string file in expectedServer2Files) { string expectedFile = Path.Combine(Path.GetDirectoryName(server2ProjectPath), file); Assert.IsTrue(server2Files.Contains(expectedFile), "Expected to see " + expectedFile + " in list of server files"); } }