public WrapperService CreateSingleService(ServiceENT Obj) { WrapperService data = new WrapperService(); data.Service = new ServiceCRUD().CreateSingle(Obj); return(data); }
internal static void RequireProcessElevated() { if (!WrapperService.IsProcessElevated()) { Assert.Ignore(); } }
public WrapperService GetSingleService(int id) { WrapperService data = new WrapperService(); data.Service = new ServiceCRUD().SelectSingle(id); return(data); }
public void ReplyTest() { var reply = new WrapperService().WrapText(new WrapRequest { Text = "slowo slowo2 slowo3", NCol = 8 }, null !); Assert.Equal("slowo sl\nowo2 slo\nwo3\n", reply.Result.Text); }
/// <summary> /// Runs a simle test, which returns the output CLI /// </summary> /// <param name="args">CLI arguments to be passed</param> /// <param name="descriptor">Optional Service descriptor (will be used for initializationpurposes)</param> /// <returns>STDOUT if there's no exceptions</returns> /// <exception cref="Exception">Command failure</exception> public static string CLITest(string[] args, ServiceDescriptor descriptor = null) { using StringWriter sw = new StringWriter(); TextWriter tmp = Console.Out; Console.SetOut(sw); WrapperService.Run(args, descriptor ?? DefaultServiceDescriptor); Console.SetOut(tmp); Console.Write(sw.ToString()); return(sw.ToString()); }
public EventLog locate() { WrapperService _service = service; if (_service != null && !_service.IsShuttingDown) { return(_service.EventLog); } // By default return null return(null); }
public static string CLITest(String[] args, ServiceDescriptor descriptor = null) { using (StringWriter sw = new StringWriter()) { Arguments arguments = new Arguments(); arguments.Action = args[0]; TextWriter tmp = Console.Out; Console.SetOut(sw); WrapperService.Run(arguments, descriptor ?? DefaultServiceDescriptor); Console.SetOut(tmp); Console.Write(sw.ToString()); return(sw.ToString()); } }
public IActionResult CreatService([FromBody] WrapperService Param) { #region Validate Token RequestResponse isAuthorized = new Authorize().RequestTokenAuth(Request); if (isAuthorized.Success == false) { return(BadRequest(isAuthorized)); } #endregion WrapperService data = new Services.ServiceService().CreateSingleService(Param.Service); return(Ok(data)); }
public static CLITestResult CLIErrorTest(String[] args, ServiceDescriptor descriptor = null) { Arguments arguments = new Arguments(); arguments.Action = args[0]; StringWriter swOut, swErr; Exception testEx = null; TextWriter tmpOut = Console.Out; TextWriter tmpErr = Console.Error; using (swOut = new StringWriter()) using (swErr = new StringWriter()) try { Console.SetOut(swOut); Console.SetError(swErr); WrapperService.Run(arguments, descriptor ?? DefaultServiceDescriptor); } catch (Exception ex) { testEx = ex; } finally { Console.SetOut(tmpOut); Console.SetError(tmpErr); Console.WriteLine("\n>>> Output: "); Console.Write(swOut.ToString()); Console.WriteLine("\n>>> Error: "); Console.Write(swErr.ToString()); if (testEx != null) { Console.WriteLine("\n>>> Exception: "); Console.WriteLine(testEx); } } return(new CLITestResult(swOut.ToString(), swErr.ToString(), testEx)); }
/// <summary> /// Runs a simle test, which returns the output CLI /// </summary> /// <param name="arguments">CLI arguments to be passed</param> /// <param name="descriptor">Optional Service descriptor (will be used for initializationpurposes)</param> /// <returns>STDOUT if there's no exceptions</returns> /// <exception cref="Exception">Command failure</exception> public static string CLITest(string[] arguments, ServiceDescriptor descriptor = null) { TextWriter tmpOut = Console.Out; TextWriter tmpErr = Console.Error; using StringWriter swOut = new StringWriter(); using StringWriter swErr = new StringWriter(); Console.SetOut(swOut); Console.SetError(swErr); try { WrapperService.Run(arguments, descriptor ?? DefaultServiceDescriptor); } finally { Console.SetOut(tmpOut); Console.SetError(tmpErr); } Assert.That(swErr.GetStringBuilder().Length, Is.Zero); Console.Write(swOut.ToString()); return(swOut.ToString()); }
public void GetParameterTest() { String expectedUsername = "******"; Assert.AreEqual(expectedUsername, WrapperService.GetParameterByName("-username:pretenduser", "-username:")); }