コード例 #1
0
        public async Task <ApiResponse <PolicyDto, GetPolicyStatus> > GetPolicyAsync(GetPolicyPayload payload)
        {
            StartLog();
            ApiResponse <PolicyDto, GetPolicyStatus> response;

            if (!Validate(payload, out string message, out string property))
            {
                response = Error <GetPolicyStatus>(message, property);
            }
コード例 #2
0
        public async Task SingleRecordOk()
        {
            var policySvc = GetService <IPolicyService>();
            var payload   = new GetPolicyPayload {
                PolicyId = 1
            };
            var response = await policySvc.GetPolicyAsync(payload);

            Assert.AreNotEqual(null, response.Data);
            Assert.AreEqual(true, response.Success);
            Assert.AreEqual(null, response.Message);
            Assert.AreEqual(null, response.MessageType);
            Assert.AreEqual(GetPolicyStatus.Ok, response.StatusCode);
        }
コード例 #3
0
        public async Task SingleRecordNegativePolicyId()
        {
            var policySvc = GetService <IPolicyService>();
            var payload   = new GetPolicyPayload {
                PolicyId = -1
            };
            var response = await policySvc.GetPolicyAsync(payload);

            Assert.AreEqual(null, response.Data);
            Assert.AreEqual(false, response.Success);
            Assert.AreNotEqual(null, response.Message);
            Assert.AreEqual(ApiMessageType.Error, response.MessageType);
            Assert.AreEqual(GetPolicyStatus.PolicyIdFormat, response.StatusCode);
        }