public async Task TestDataHandling() { using (var project = Services.ProjectService.CreateDotNetProject("C#")) using (var workspace = await IdeApp.TypeSystemService.CreateEmptyWorkspace()) { var map = new MonoDevelopWorkspace.ProjectDataMap(workspace); var pid = map.GetOrCreateId(project, null); var data = map.GetData(pid); Assert.IsNull(data); Assert.IsFalse(map.Contains(pid)); data = map.CreateData(pid, ImmutableArray <MonoDevelopMetadataReference> .Empty); Assert.IsNotNull(data); Assert.IsTrue(map.Contains(pid)); map.RemoveData(pid); data = map.GetData(pid); Assert.IsNull(data); Assert.IsFalse(map.Contains(pid)); } }
public async Task TestDataHandling_MultiTargetFramework() { var projectFile = Util.GetSampleProject("multi-target", "multi-target.csproj"); using (var project = (DotNetProject)await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), projectFile)) using (var workspace = await IdeApp.TypeSystemService.CreateEmptyWorkspace()) { var map = new MonoDevelopWorkspace.ProjectDataMap(workspace); var pid = map.GetOrCreateId(project, null, "netcoreapp1.1"); var data = map.GetData(pid); Assert.IsNull(data); Assert.IsFalse(map.Contains(pid)); var pid2 = map.GetOrCreateId(project, null, "netstandard1.0"); var data2 = map.GetData(pid2); Assert.IsNull(data2); Assert.IsFalse(map.Contains(pid2)); data = map.CreateData(pid, ImmutableArray <MonoDevelopMetadataReference> .Empty); Assert.IsNotNull(data); Assert.IsTrue(map.Contains(pid)); data2 = map.CreateData(pid2, ImmutableArray <MonoDevelopMetadataReference> .Empty); Assert.IsNotNull(data2); Assert.IsTrue(map.Contains(pid2)); map.RemoveData(pid); data = map.GetData(pid); Assert.IsNull(data); Assert.IsFalse(map.Contains(pid)); Assert.IsTrue(map.Contains(pid2)); map.RemoveData(pid2); data2 = map.GetData(pid2); Assert.IsNull(data2); Assert.IsFalse(map.Contains(pid2)); } }