예제 #1
0
        public void GetUncompressedResume_Successful()
        {
            var response = new GetDetailsResponse()
            {
                ExecutionResult = SuccessResult(),
                Resumes         = new[] { new Details()
                                          {
                                              CompressedRTF = new byte[1] {
                                                  1
                                              },
                                              Created    = DateTime.Now,
                                              CreatedID  = "1234567890",
                                              IsDefault  = true,
                                              ResumeID   = 1234567890,
                                              ResumeName = "Test Resume",
                                              RowVersion = 1234567890,
                                              RTF        = "\\rtf",
                                              Timestamp  = 1234567890
                                          } }
            };

            mockResumeService.Setup(m => m.GetDetailsUncompressed(It.Is <GetDetailsRequest>(i => i.ResumeID == 1234567890)))
            .Returns(response);
            var service = SystemUnderTest();
            var result  = service.GetUncompressedResume(1234567890);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.RTF, "\\rtf");
            Assert.AreEqual(result.Timestamp, 1234567890);
            mockResumeService.Verify(m => m.GetDetailsUncompressed(It.Is <GetDetailsRequest>(i => i.ResumeID == 1234567890)), Times.Once());
        }
예제 #2
0
        public async Task <GetDetailsResponse> GetDetails(Provider provider, string id, PaymentIdType idType)
        {
            if (channel.State == ChannelState.Shutdown)
            {
                var response = new GetDetailsResponse();
                response.Errors.Add(setClientShutDownError());
                return(response);
            }

            GetDetailsRequest request = new GetDetailsRequest()
            {
                Provider   = provider,
                Identifier = id,
                IdType     = idType
            };

            try
            {
                return(await client.GetDetailsAsync(request));
            }
            catch (RpcException ex)
            {
                var response = new GetDetailsResponse();
                response.Errors.Add(setGatewayError(ex.Message));
                return(response);
            }
        }
예제 #3
0
        public override async Task <GetDetailsResponse> GetDetails(GetDetailsRequest request, ServerCallContext context)
        {
            var details = await _client.GetClassAsync(request.Id);

            if (null == details)
            {
                return(null);
            }
            var result = new GetDetailsResponse()
            {
                Id     = details.Index,
                Name   = details.Name,
                HitDie = details.Hit_Die
            };

            if (null != details.Proficiencies)
            {
                result.Proficiencies.AddRange(details.Proficiencies.Select(p => new GetDetailsResponse.Types.Proficiency()
                {
                    Name = p.Name
                }));
            }

            return(result);
        }
예제 #4
0
        public async Task <IActionResult> Details(string id)
        {
            TempData["actionInitiated"] = true;

            var payment = await paymentRepository.Find(id);

            var           provider   = Enum.Parse <Provider>(payment.Provider);
            var           identifier = payment.TransactionId ?? payment.Token;
            PaymentIdType idType     = payment.TransactionId == null ? PaymentIdType.Token : PaymentIdType.TransactionId;

            GetDetailsResponse response = await rcpgClient.GetDetails(provider, identifier, idType);

            if (response.Errors.Any())
            {
                TempData["hasErrors"]        = true;
                TempData["notificationText"] = $"Notikusi kļūda. Kļūdas avots: \"{response.Errors.First().Source}\", kļūdas kods: \"{response.Errors.First().ErrorCode}\"";
                return(redirectToLandingPage());
            }

            string json = JObject.Parse(response.Details).ToString(Formatting.Indented);

            return(View("Details", json));
        }