public void RestrictionPattern_Constructor_EmptyObjectId_Failure() { Reset(); RestrictionPattern oTest = new RestrictionPattern(_mockServer, "", "bogus"); Console.WriteLine(oTest); }
public void GetRestrictionPatterns_NullConnectionServer_Failure() { List <RestrictionPattern> oPatterns; var res = RestrictionPattern.GetRestrictionPatterns(null, "bogus", out oPatterns); Assert.IsFalse(res.Success, "Static call to GetRestrictionPattners did not fail with null Connection server"); }
public void RestrictionTable_Constructor_NullConnectionServerWithObjectIds_Failure() { Reset(); RestrictionPattern oTest = new RestrictionPattern(null, "bogus", "bogus"); Console.WriteLine(oTest); }
public void GetRestrictionPatterns_EmptyObjectId_Failure() { List <RestrictionPattern> oPatterns; var res = RestrictionPattern.GetRestrictionPatterns(_mockServer, "", out oPatterns); Assert.IsFalse(res.Success, "Static call to GetRestrictionPattners did not fail with empty objectId"); }
public void GetRestrictionPatterns_InvalidObjectId_Success() { List <RestrictionPattern> oPatterns; var res = RestrictionPattern.GetRestrictionPatterns(_connectionServer, "InvalidObjectId", out oPatterns); Assert.IsTrue(res.Success, "Static call to GetRestrictionPattners should not fail with invalid objectId:" + res); Assert.IsTrue(oPatterns.Count == 0, "Call to GetRestrictionPatterns with invalid objectId should return empty list"); }
public void GetRestrictionPatterns_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 <RestrictionPattern> oPatterns; var res = RestrictionPattern.GetRestrictionPatterns(_mockServer, "ErrorResponse", out oPatterns, 1, 2); Assert.IsFalse(res.Success, "Calling GetRestrictionPatterns with ErrorResponse should fail"); Assert.IsTrue(oPatterns.Count == 0, "Error response should result in an empty list"); }
public void GetRestrictionPatterns_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 <RestrictionPattern> oPatterns; var res = RestrictionPattern.GetRestrictionPatterns(_mockServer, "InvalidResultText", out oPatterns, 1, 2); Assert.IsTrue(res.Success, "Calling GetRestrictionPatterns with InvalidResultText should not fail:" + res); Assert.IsTrue(oPatterns.Count == 0, "Invalid response text should result in an empty list"); }
public void GetRestrictionPatterns_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 <RestrictionPattern> oPatterns; var res = RestrictionPattern.GetRestrictionPatterns(_mockServer, "EmptyResultText", out oPatterns, 1, 2); Assert.IsFalse(res.Success, "Calling GetRestrictionPatterns with empty result text should fail"); Assert.IsTrue(oPatterns.Count == 0, "Empty response text should result in an empty list"); }
public void RestrictionPattern_ConstructorWithObjectId_Success() { var oTable = HelperGetRestrictionTable(); try { RestrictionPattern oNewPattern = new RestrictionPattern(_connectionServer, oTable.ObjectId, oTable.RestrictionPatterns()[0].ObjectId); Console.WriteLine(oNewPattern); } catch (Exception ex) { Assert.Fail("RestrictionPattern class creation failed with valid objectId:" + ex); } }
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); }
public void RestrictionPattern_Constructor_ErrorResponse_Failure() { //error response _mockTransport.Setup(x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = false, ResponseText = "error text", StatusCode = 404 }); try { RestrictionPattern oPattern = new RestrictionPattern(_mockServer, "ErrorResponse", "objectid"); Assert.Fail("Creating restriction pattern with error response text should fail"); } catch { } }
public void RestrictionPattern_Constructor_GarbageResponse_Failure() { //garbage response _mockTransport.Setup( x => x.GetCupiResponse(It.IsAny <string>(), It.IsAny <MethodType>(), It.IsAny <ConnectionServerRest>(), It.IsAny <string>(), true)).Returns(new WebCallResult { Success = true, ResponseText = "garbage result", TotalObjectCount = 1 }); try { RestrictionPattern oPattern = new RestrictionPattern(_mockServer, "InvalidResultText", "objectid"); Assert.Fail("Creating restriction pattern with garbage response text should fail"); } catch { } }
public void RestrictionPattern_Constructor_InvalidObjectIds_Failure() { RestrictionPattern oTest = new RestrictionPattern(_connectionServer, "bogusRestrictionTableObjectId", "bogusObjectId"); Console.WriteLine(oTest); }