public void TestQuickStart() { var role = "roles/logging.logWriter"; var member = "serviceAccount:" + _serviceAccount.Email; // Initialize service var crmService = QuickStart.InitializeService(); // Add member to role QuickStart.AddBinding(crmService, _projectId, member, role); // Get the project's policy and confirm that the member is in the policy var policy = QuickStart.GetPolicy(crmService, _projectId); var binding = policy.Bindings.FirstOrDefault(x => x.Role == role); Assert.Contains(member, binding.Members); // Remove member QuickStart.RemoveMember(crmService, _projectId, member, role); // Confirm that the member has been removed policy = QuickStart.GetPolicy(crmService, _projectId); binding = policy.Bindings.FirstOrDefault(x => x.Role == role); if (binding != null) { Assert.DoesNotContain(member, binding.Members); } }
/// <summary>Runs StorageSample.exe with the provided arguments</summary> /// <returns>The console output of this program</returns> public static ConsoleOutput Run(params string[] arguments) { Console.Write("QuickStart.exe "); Console.WriteLine(string.Join(" ", arguments)); using (var output = new StringWriter()) { QuickStart quickStart = new QuickStart(output); var consoleOutput = new ConsoleOutput() { ExitCode = quickStart.Run(arguments), Stdout = output.ToString() }; Console.Write(consoleOutput.Stdout); return(consoleOutput); } }
/// <summary>Runs StorageSample.exe with the provided arguments</summary> /// <returns>The console output of this program</returns> private RunResult Run(params string[] arguments) { Console.Write("QuickStart.exe "); Console.WriteLine(string.Join(" ", arguments)); var standardOut = Console.Out; using (var output = new StringWriter()) { Console.SetOut(output); try { return(new RunResult() { ExitCode = QuickStart.Main(arguments), Stdout = output.ToString() }); } finally { Console.SetOut(standardOut); } } }
public static int Main(string[] args) { QuickStart quickStart = new QuickStart(); return(quickStart.Run(args)); }
public void TestMain() { // Main() will throw an exception if something fails. QuickStart.Main(new string[] { }); Assert.True(true); }
public static object ListCompanies() { QuickStart.Main(null); return(0); }
public static int Main(string[] args) { QuickStart quickStart = new QuickStart(); return quickStart.Run(args); }