public void GetRestrictionTables_NullConnectionServer_Failure() { //static fetch failures List <RestrictionTable> oTables; var res = RestrictionTable.GetRestrictionTables(null, out oTables); Assert.IsFalse(res.Success, "Static restriction table creation did not fail with null ConnectionServer"); }
private RestrictionTable HelperGetRestrictionTable() { List <RestrictionTable> oTables; WebCallResult res = RestrictionTable.GetRestrictionTables(_connectionServer, out oTables, 1, 2); Assert.IsTrue(res.Success, "Fetching restriction tables failed:" + res); Assert.IsTrue(oTables.Count > 0, "No restriction tables fetched"); return(oTables[0]); }
public void GetRestrictionTables_WithQueryThatReturnsNoResults_Success() { List <RestrictionTable> oTables; var res = RestrictionTable.GetRestrictionTables(_connectionServer, out oTables, 1, 2, "query=(ObjectId is Bogus)"); Assert.IsTrue(res.Success, "fetching RTs with invalid query should not fail:" + res); Assert.IsTrue(oTables.Count == 0, "Invalid query string should return an empty RT list:" + oTables.Count); }
public void GetRestrictionTables_GarbageResponse_Success() { //garbage response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "garbage result" }); List <RestrictionTable> oTables; var res = RestrictionTable.GetRestrictionTables(_mockServer, out oTables, 1, 2, "InvalidResultText"); Assert.IsTrue(res.Success, "Calling GetRestrictionTables with InvalidResultText should not fail:" + res); Assert.IsTrue(oTables.Count == 0, "Invalid response text should result in an empty list"); }
public void GetRestrictionTables_ErrorResponse_Failure() { //error response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), MethodType.GET, It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = false, ResponseText = "error text", StatusCode = 404 }); List <RestrictionTable> oTables; var res = RestrictionTable.GetRestrictionTables(_mockServer, out oTables, 1, 2, "ErrorResponse"); Assert.IsFalse(res.Success, "Calling GetRestrictionTables with ErrorResponse should fail"); Assert.IsTrue(oTables.Count == 0, "Error response should result in an empty list"); }
public void GetRestrictionTables_EmptyResponse_Failure() { //empty results _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "" }); List <RestrictionTable> oTables; var res = RestrictionTable.GetRestrictionTables(_mockServer, out oTables, 1, 2, "EmptyResultText"); Assert.IsFalse(res.Success, "Calling GetRestrictionTables with empty result text should fail"); Assert.IsTrue(oTables.Count == 0, "Empty response text should result in an empty list"); }
public void GetRestrictionTables_NullQuery_Success() { List <RestrictionTable> oTables; WebCallResult res = RestrictionTable.GetRestrictionTables(_connectionServer, out oTables, 1, 2, null); Assert.IsTrue(res.Success, "Fetching restriction tables failed:" + res); Assert.IsTrue(oTables.Count > 0, "No restriction tables fetched"); try { RestrictionPattern oPattern = new RestrictionPattern(_connectionServer, oTables[0].ObjectId); } catch (Exception ex) { Assert.Fail("Creating new pattern object without an objectId should not fail:" + ex); } }
public void RestrictionTable_Test() { _errorString = ""; List <RestrictionTable> oRestrictionTables; var res = RestrictionTable.GetRestrictionTables(_connectionServer, out oRestrictionTables, 1, 2); Assert.IsTrue(res.Success & oRestrictionTables.Count > 0, "Failed to fetch restrictiontable:" + res); Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString); //Restriction table pattern List <RestrictionPattern> oRestrictionPatterns; res = RestrictionPattern.GetRestrictionPatterns(_connectionServer, oRestrictionTables[0].ObjectId, out oRestrictionPatterns); Assert.IsTrue(res.Success & oRestrictionTables.Count > 0, "Failed to fetch restrictiontablepattern:" + res); Assert.IsTrue(string.IsNullOrEmpty(_errorString), _errorString); }