public void ShouldSetMultipleFromObjectPassedFromPipeline() { // Setup var sut = RandomObjectFactory.GenerateRandomObjects <T>(); // Test var script = string.Format( "$obj1 = {0};$obj2={1}; $obj1,$obj2 | {2}-{3}", sut[0].ToPsScript(), sut[1].ToPsScript(), verb, noun); PsRunner.ExecutePanosPowerShellScript(script); // Validate foreach (var obj in sut) { var confirmationObject = this.searchableRepository.GetSingle <TDeserializer>(obj.Name, ConfigTypes.Candidate); Assert.IsTrue(confirmationObject.Any()); Assert.AreEqual(obj, confirmationObject.Single()); } // Cleanup foreach (var obj in sut) { DeletableRepository.Delete(obj.SchemaName, obj.Name); } }
public void CommitTest() { // Setup var newObj = RandomObjectFactory.GenerateRandomObject <AddressObject>(); AddableRepository.Add(newObj); var makeChangeScript = $"$obj = {newObj.ToPsScript()};Add-PANOSObject -ConnectionProperties $ConnectionProperties -FirewallObject $obj"; PsRunner.ExecutePanosPowerShellScript(makeChangeScript); // Test const string CommitScript = "Save-PANOSChanges -ConnectionProperties $ConnectionProperties"; var results = PsRunner.ExecutePanosPowerShellScript(CommitScript); // Validate Assert.IsNotNull(results[0]); var apiEnqueuedResponse = results[0].BaseObject as ApiEnqueuedResponse; Assert.IsNotNull(apiEnqueuedResponse); var job = apiEnqueuedResponse.Job; Assert.IsNotNull(job); Assert.IsTrue(job.Id > 0); // Cleanup this.DeletableRepository.Delete(newObj.SchemaName, newObj.Name); }
public void CommitWhileAnotherCommitIsInProgressTest() { // Setup var newObj = RandomObjectFactory.GenerateRandomObject <AddressObject>(); AddableRepository.Add(newObj); var makeChangeScript = $"$obj = {newObj.ToPsScript()};Add-PANOSObject -ConnectionProperties $ConnectionProperties -FirewallObject $obj"; PsRunner.ExecutePanosPowerShellScript(makeChangeScript); // Test const string CommitScript = "Save-PANOSChanges -ConnectionProperties $ConnectionProperties"; PsRunner.ExecutePanosPowerShellScript(CommitScript); Assert.That(() => PsRunner.ExecutePanosPowerShellScript(CommitScript), Throws.TypeOf <CmdletInvocationException>()); }