public void TestPingWithError() { IptFlowControlClient client = new IptFlowControlClient(); StatusType status = null; SIFHeaderType header = createHeader(); header.SourceId = "Olympus"; // Triggers an error in the server bool exceptionThrown = false; try { status = client.Ping(ref header, new PingType()); } catch (FaultException <DataModelErrorType> ex) { exceptionThrown = true; Assert.AreEqual(ex.Detail.Category, InfrastructureErrorCategoryType.Item11, "Expected Category of 11"); Assert.AreEqual(ex.Detail.Code, "1", "Expected Code of 1"); } catch (Exception ex) { Assert.Fail("Unable to parse SOAP Fault into expected exception type: " + ex.ToString()); } Assert.IsTrue(exceptionThrown, "A SOAP Fault was not returned"); }
public void TestPing() { IptFlowControlClient client = new IptFlowControlClient(); StatusType status = null; SIFHeaderType header = createHeader(); //PingRequest request = new PingRequest( header, new PingType() ); status = client.Ping(ref header, new PingType()); runAssertions(header); Console.WriteLine("Invoked with return code " + status.Code); Assert.AreEqual(status.Code, InfrastructureStatusCodeType.Item0); Assert.AreEqual(status.Desc, "Success"); }
public void TestPingWithError() { IptFlowControlClient client = new IptFlowControlClient(); StatusType status = null; SIFHeaderType header = createHeader(); header.SourceId = "Olympus"; // Triggers an error in the server bool exceptionThrown = false; try { status = client.Ping(ref header, new PingType()); } catch (FaultException<DataModelErrorType> ex) { exceptionThrown = true; Assert.AreEqual(ex.Detail.Category, InfrastructureErrorCategoryType.Item11, "Expected Category of 11"); Assert.AreEqual(ex.Detail.Code, "1", "Expected Code of 1"); } catch (Exception ex) { Assert.Fail("Unable to parse SOAP Fault into expected exception type: " + ex.ToString()); } Assert.IsTrue(exceptionThrown, "A SOAP Fault was not returned"); }