コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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");
        }
コード例 #5
0
        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");
        }
コード例 #6
0
        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");
        }
コード例 #7
0
        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);
        }