public static IWorkspaceProjectContext CreateForSourceFiles(UnconfiguredProject project, Action <string>?addSourceFile = null, Action <string>?removeSourceFile = null) { var context = new IWorkspaceProjectContextMock(); context.SetupGet(c => c.ProjectFilePath) .Returns(project.FullPath); if (addSourceFile != null) { context.Setup(c => c.AddSourceFile(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <IEnumerable <string> >(), It.IsAny <SourceCodeKind>())) .Callback <string, bool, IEnumerable <string>, SourceCodeKind>((p1, p2, p3, p4) => addSourceFile(p1)); } if (removeSourceFile != null) { context.Setup(c => c.RemoveSourceFile(It.IsAny <string>())) .Callback(removeSourceFile); } return(context.Object); }
public static IWorkspaceProjectContext CreateForDynamicFiles(UnconfiguredProject project, Action <string>?addDynamicFile = null) { var context = new IWorkspaceProjectContextMock(); context.SetupGet(c => c.ProjectFilePath) .Returns(project.FullPath); if (addDynamicFile != null) { context.Setup(c => c.AddDynamicFile(It.IsAny <string>(), It.IsAny <IEnumerable <string> >())) .Callback <string, IEnumerable <string> >((p1, p2) => addDynamicFile(p1)); } return(context.Object); }