public void PluginServicesNamespacesWithInvalidArgsExpectedReturnsEmptyList() { var services = new PluginServices(); var result = services.Namespaces(new PluginSource(), Guid.Empty, Guid.Empty); Assert.AreEqual(0, result.Count); }
public override StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace) { var serializer = new Dev2JsonSerializer(); try { var dbSource = serializer.Deserialize <PluginSourceDefinition>(values["source"]); var containsKey = values.ContainsKey("fetchJson"); var services = new PluginServices(); var src = ResourceCatalog.Instance.GetResource <PluginSource>(GlobalConstants.ServerWorkspaceID, dbSource.Id); var methods = containsKey ? services.NamespacesWithJsonObjects(src, Guid.Empty, Guid.Empty).Select(a => a as INamespaceItem).ToList() : services.Namespaces(src, Guid.Empty, Guid.Empty).Select(a => a as INamespaceItem).ToList(); return(serializer.SerializeToBuilder(new ExecuteMessage() { HasError = false, Message = serializer.SerializeToBuilder(methods) })); } catch (Exception e) { return(serializer.SerializeToBuilder(new ExecuteMessage() { HasError = true, Message = new StringBuilder(e.Message) })); } }
public void PluginServicesNamespacesWithValidArgsExpectedReturnsList() { var source = CreatePluginSource(); var args = source.ToString(); var workspaceID = Guid.NewGuid(); EnvironmentVariables.GetWorkspacePath(workspaceID); var services = new PluginServices(); var result = services.Namespaces(source, workspaceID, Guid.Empty); // DO NOT assert equality on Count as this will // change as new namespaces are added to this assembly! Assert.IsTrue(result.Count > 0); }