public void GetProfileTest()
        {
            //Arrange
            var request = new GetProfileRequest()
            {
                UserName    = user.UserName,
                SecurityKey = _seqkey,
            };

            var exStatus = HttpStatusCode.OK;
            var exResult = new GetProfileResult()
            {
                ErrorMessage = "",
                Success      = true,
                UserName     = user.UserName,
                Avatar       = null,
                Password     = user.Password
            };

            //Act
            var act = ctrl.GetProfile(request);
            GetProfileResult actContent;
            var hasContent = act.TryGetContentValue(out actContent);

            //Assert
            Assert.AreEqual(exStatus, act.StatusCode, "status code");
            Assert.IsTrue(hasContent, "has content");
            Assert.AreEqual(exResult.ErrorMessage, actContent.ErrorMessage, "error message");
            Assert.AreEqual(exResult.Success, actContent.Success, "success bool");
            Assert.AreEqual(exResult.UserName, actContent.UserName, "user not default");
            Assert.AreEqual(exResult.Password, actContent.Password, "user not default");
            Assert.AreEqual(exResult.Avatar, actContent.Avatar, "user not default");
        }
예제 #2
0
        public async Task <MessageOutputBase> Profile(GetProfileRequest request)
        {
            MessageOutputBase result = null;

            request.CurrentUserName = GetCurrentUser();

            await Execute(flow =>
            {
                flow.StartRegisterFlow()
                .Add <CheckUserExistsStep>()
                .Add <GetProfileStep>();

                flow.
                When <UserNotFoundStep, UserNotFoundParams>(notFound =>
                {
                    result = notFound.Response;
                })
                .When <GetProfileStep, GetProfileParams>(fetch =>
                {
                    result = fetch.Response;
                });
            }, request,
                          error =>
            {
                result = error;
            });

            return(result);
        }
        async Task ExecuteBlockContactCommand(GetProfileRequest model)
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;
            try
            {
                var blockResult = await DataStore.BlockAccountAsync(model);

                if (blockResult)
                {
                    var contactIdToBlock = Convert.ToInt32(model.USERID);
                    foreach (var item in Items)
                    {
                        if (item.CONTACT_ID == contactIdToBlock)
                        {
                            var ItemTemp = item;
                            Items.Remove(item);
                            ItemTemp.IS_I_BLOCKED = true;
                            Items.Add(ItemTemp);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #4
0
        public async Task <ContactDTO> GetContactDetailAsync(GetProfileRequest model)
        {
            try
            {
                using (var httpClient = GetHttpClient())
                {
                    var stringContent = new List <KeyValuePair <string, string> >();
                    stringContent.Add(new KeyValuePair <string, string>("TOKEN", model.TOKEN));
                    stringContent.Add(new KeyValuePair <string, string>("USERID", model.USERID));
                    var content = new MultipartFormDataContent();
                    foreach (var keyValuePair in stringContent)
                    {
                        content.Add(new StringContent(keyValuePair.Value), keyValuePair.Key);
                    }
                    var response = await httpClient.PostAsync(ServerURL.GetContactDetailURL, content);

                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        string retVal = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                        var responseItem = JsonConvert.DeserializeObject <CommonResponse>(retVal);
                        return(JsonConvert.DeserializeObject <ContactDTO>(responseItem.MSG));
                    }
                }
            }
            catch (Exception exp)
            {
            }
            return(null);
        }
예제 #5
0
        public async Task <GetProfileResponse> GetProfileAsync() =>
        await Task.Run(async() => {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            GetProfileRequest getProfileRequest = new GetProfileRequest {
                Url         = GlobalSettings.Instance.Endpoints.ProfileEndpoints.GetProfileEndPoints,
                AccessToken = GlobalSettings.Instance.UserProfile.AccesToken
            };

            GetProfileResponse getProfileResponse = null;

            try {
                getProfileResponse =
                    await _requestProvider.GetAsync <GetProfileRequest, GetProfileResponse>(getProfileRequest);
            }
            catch (ServiceAuthenticationException exc) {
                _identityUtilService.RefreshToken();

                throw exc;
            }
            catch (Exception ex) {
                Crashes.TrackError(ex);

                Debug.WriteLine($"ERROR:{ex.Message}");
                Debugger.Break();
                throw new Exception(ex.Message);
            }

            return(getProfileResponse);
        });
예제 #6
0
        public async Task <IActionResult> GetProfile([FromQuery] GetProfileRequest contract, CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ResponseMessage {
                    Message = "One or more validation errors occurred."
                }));
            }

            var user = (User)Request.HttpContext.Items["User"];

            if (user.ProfileId != contract.Id)
            {
                return(BadRequest(new ResponseMessage {
                    Message = "Profile Id is not correct."
                }));
            }

            var profile = await _service.GetProfile(contract.Id, cancellationToken);

            if (profile == null)
            {
                return(BadRequest(new ResponseMessage {
                    Message = "Profile not found"
                }));
            }
            return(Ok(_mapper.Map <GetProfileResponse>(profile)));
        }
        public void GetProfile2()
        {
            Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict);
            GetProfileRequest request = new GetProfileRequest
            {
                ProfileName = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"),
            };
            Profile expectedResponse = new Profile
            {
                ProfileName    = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"),
                ExternalId     = "externalId-1153075697",
                Source         = "source-896505829",
                Uri            = "uri116076",
                GroupId        = "groupId506361563",
                ResumeHrxml    = "resumeHrxml1834730555",
                Processed      = true,
                KeywordSnippet = "keywordSnippet1325317319",
            };

            mockGrpcClient.Setup(x => x.GetProfile(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null);
            Profile response            = client.GetProfile(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #8
0
        public GetProfileResult GetProfile(GetProfileRequest request)
        {
            var result = new GetProfileResult();

            try
            {
                var user = _cache.RefreshAndGet(
                    Users,
                    request.UserName,
                    new UserNotFoundException(string.Format("User name: {0} not found. please re-login.", request.UserName))
                    );
                UserManager.SecurityCheck(request.SecurityKey, user);

                result.Avatar   = (user.Avatar)?.Select(b => (int)b).ToArray();
                result.Password = user.Password;
                result.UserName = request.UserName;
                result.Success  = true;
            }
            catch (PokerException e)
            {
                result.Success      = false;
                result.ErrorMessage = e.Message;
                Logger.Log(e.Message, this);
            }

            return(result);
        }
예제 #9
0
        public async Task GetProfileAsync2()
        {
            Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict);
            GetProfileRequest request = new GetProfileRequest
            {
                ProfileName = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"),
            };
            Profile expectedResponse = new Profile
            {
                ProfileName    = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"),
                ExternalId     = "externalId-1153075697",
                Source         = "source-896505829",
                Uri            = "uri116076",
                GroupId        = "groupId506361563",
                Processed      = true,
                KeywordSnippet = "keywordSnippet1325317319",
            };

            mockGrpcClient.Setup(x => x.GetProfileAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Profile>(Task.FromResult(expectedResponse), null, null, null, null));
            ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null);
            Profile response            = await client.GetProfileAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #10
0
        public async void getProfile(GetProfileRequest commonRequest, Action success, Action <ProfileResponse> failed)
        {
            bool IsNetwork = true;//await DependencyService.Get<IMediaService>().CheckNewworkConnectivity();

            if (IsNetwork)
            {
                //commonRequest.Email = "*****@*****.**";
                //commonRequest.Password = "******";
                string para = "email=" + commonRequest.EmailId + "&userid=" + commonRequest.UserId;
                var    url  = string.Format("{0}profile.php?" + para, _settingsManager.ApiHost);

                await Task.Run(() =>
                {
                    Dictionary <string, string> head = GetHeaders();
                    var result = _apiProvider.Get <ProfileResponse, LoginRequest>(url, null).Result;
                    if (result.IsSuccessful)
                    {
                        if (success != null)
                        {
                            profileResponse = result.Result;
                            success.Invoke();
                        }
                    }
                    else
                    {
                        failed.Invoke(result.Result);
                    }
                });
            }
            else
            {
                UserDialogs.Instance.HideLoading(); UserDialogs.Instance.Alert(error, null, "OK");
            }
        }
예제 #11
0
        public void GetProfile()
        {
            GetProfileRequest obj = new GetProfileRequest();

            obj.EmailId = Email;
            obj.UserId  = UserId;
            UserDialogs.Instance.ShowLoading("Requesting..");
            userManager.getProfile(obj, () =>
            {
                var userProfileResponse = userManager.ProfileResponse;

                if (userProfileResponse.StatusCode == 202)
                {
                    var udata    = userProfileResponse.UserData;
                    Address1     = udata.Address1;
                    Address2     = udata.Address2;
                    Address3     = udata.Address3;
                    State        = udata.State;
                    City         = udata.City;
                    Country      = udata.Country;
                    Email        = udata.EmailId;
                    FirstName    = udata.FirstName;
                    Hobbies      = udata.Hobbies;
                    LastName     = udata.LastName;
                    UserName     = udata.UserName;
                    MobileNumber = udata.MobileNumber;
                    Password     = udata.Password;
                    PhoneNumber  = udata.PhoneNumber;
                    Postcode     = udata.Postcode;
                    Picture      = udata.PhotoURL;
                    DateOfBirth  = udata.DateOfBirth;
                    Gender       = udata.Gender;
                    AboutMe      = udata.AboutMe;
                    ImageBase64  = "";
                    if (!string.IsNullOrEmpty(udata.PhotoURL))
                    {
                        PictureSource = new UriImageSource
                        {
                            Uri            = new Uri(udata.PhotoURL),
                            CachingEnabled = true,
                        };
                        // ImageBase64 = await GetImageAsBase64Url(udata.PhotoURL);
                    }
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(async() =>
                    {
                        UserDialogs.Instance.HideLoading();
                        await((MasterDetailPage)App.Current.MainPage).Detail.Navigation.PushAsync(new ProfileSetting());
                    });
                }
            },
                                   (requestFailedReason) =>
            {
                Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
                {
                    //  UserDialogs.Instance.Alert(requestFailedReason.Message, null, "OK");
                    UserDialogs.Instance.HideLoading();
                });
            });
        }
예제 #12
0
        public async Task <IActionResult> GetProfile([FromQuery] GetProfileRequest request)
        {
            var response = await mediator.Send(request);

            Log.Information($"User #{HttpContext.GetCurrentUserId()} fetched their profile data");

            return(this.CreateResponse(response));
        }
예제 #13
0
        public async Task <IActionResult> GetProfile([FromQuery] GetProfileRequest request)
        {
            var response = await mediator.Send(request);

            logger.LogResponse($"User #{HttpContext.GetCurrentUserId()} displayed profile", response.Error);

            return(response.IsSucceeded ? (IActionResult)Ok(response) : BadRequest(response));
        }
        public void GetProfile()
        {
            var request = new GetProfileRequest(ProfileRequests.GetProfile);

            request.Parse();
            Assert.Equal((int)0, request.ProfileId);
            Assert.Equal("xxxx", request.SessionKey);
        }
예제 #15
0
        /// <summary>
        /// Gets a member's public profile.
        /// </summary>
        /// <param name="memberId">the member id of the member</param>
        /// <returns>the profile</returns>
        public Task <Profile> GetProfile(string memberId)
        {
            var request = new GetProfileRequest {
                MemberId = memberId
            };

            return(gateway(authenticationContext()).GetProfileAsync(request)
                   .ToTask(response => response.Profile));
        }
예제 #16
0
        public GetProfileResponse GetProfile(GetProfileRequest getProfileRequest)
        {
            SetupIntent setupIntent = _adaptee.GetProfile(getProfileRequest.Token);

            return(new GetProfileResponse()
            {
                PaymentMethod = setupIntent.PaymentMethodId
            });
        }
예제 #17
0
        /// <summary>
        /// Gets the aggregated profile of a profiling group for the specified time range. If
        /// the requested time range does not align with the available aggregated profiles, it
        /// is expanded to attain alignment. If aggregated profiles are available only for part
        /// of the period requested, the profile is returned from the earliest available to the
        /// latest within the requested time range.
        ///
        ///
        /// <para>
        /// For example, if the requested time range is from 00:00 to 00:20 and the available
        /// profiles are from 00:15 to 00:25, the returned profile will be from 00:15 to 00:20.
        ///
        /// </para>
        ///
        /// <para>
        /// You must specify exactly two of the following parameters: <code>startTime</code>,
        /// <code>period</code>, and <code>endTime</code>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetProfile service method.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        ///
        /// <returns>The response from the GetProfile service method, as returned by CodeGuruProfiler.</returns>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.InternalServerException">
        /// The server encountered an internal error and is unable to complete the request.
        /// </exception>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.ResourceNotFoundException">
        /// The resource specified in the request does not exist.
        /// </exception>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.ThrottlingException">
        /// The request was denied due to request throttling.
        /// </exception>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.ValidationException">
        /// The parameter is not valid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codeguruprofiler-2019-07-18/GetProfile">REST API Reference for GetProfile Operation</seealso>
        public virtual Task <GetProfileResponse> GetProfileAsync(GetProfileRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetProfileRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetProfileResponseUnmarshaller.Instance;

            return(InvokeAsync <GetProfileResponse>(request, options, cancellationToken));
        }
예제 #18
0
        public bool GetProfile(OnGetProfile callback, string source,
                               string contentType           = ContentType.TextPlain,
                               string contentLanguage       = ContentLanguage.English,
                               string accept                = ContentType.ApplicationJson,
                               string acceptLanguage        = AcceptLanguage.English,
                               bool raw_scores              = false,
                               bool csv_headers             = false,
                               bool consumption_preferences = false,
                               string version               = PersonalityInsightsVersion.Version,
                               string data = default(string))
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (string.IsNullOrEmpty(source))
            {
                throw new ArgumentNullException("A JSON or Text source is required for GetProfile!");
            }

            RESTConnector connector = RESTConnector.GetConnector(Credentials, ProfileEndpoint);

            if (connector == null)
            {
                return(false);
            }

            GetProfileRequest req = new GetProfileRequest();

            req.Source     = source;
            req.Callback   = callback;
            req.Data       = data;
            req.OnResponse = GetProfileResponse;

            req.Parameters["raw_scores"]              = raw_scores.ToString();
            req.Parameters["csv_headers"]             = csv_headers.ToString();
            req.Parameters["consumption_preferences"] = consumption_preferences.ToString();
            req.Parameters["version"] = version;

            req.Headers["Content-Type"]     = contentType;
            req.Headers["Content-Language"] = contentLanguage;
            req.Headers["Accept"]           = accept;
            req.Headers["Accept-Language"]  = acceptLanguage;

            if (source.StartsWith(Application.dataPath))
            {
                string jsonData = default(string);
                jsonData = File.ReadAllText(source);
                req.Send = System.Text.Encoding.UTF8.GetBytes(jsonData);
            }
            else
            {
                req.Send = System.Text.Encoding.UTF8.GetBytes(source);
            }

            return(connector.Send(req));
        }
예제 #19
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetProfile operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetProfile operation on AmazonCodeGuruProfilerClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetProfile
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codeguruprofiler-2019-07-18/GetProfile">REST API Reference for GetProfile Operation</seealso>
        public virtual IAsyncResult BeginGetProfile(GetProfileRequest request, AsyncCallback callback, object state)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetProfileRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetProfileResponseUnmarshaller.Instance;

            return(BeginInvoke(request, options, callback, state));
        }
예제 #20
0
        /// <summary>
        /// Gets the aggregated profile of a profiling group for the specified time range. If
        /// the requested time range does not align with the available aggregated profiles, it
        /// is expanded to attain alignment. If aggregated profiles are available only for part
        /// of the period requested, the profile is returned from the earliest available to the
        /// latest within the requested time range.
        ///
        ///
        /// <para>
        /// For example, if the requested time range is from 00:00 to 00:20 and the available
        /// profiles are from 00:15 to 00:25, the returned profile will be from 00:15 to 00:20.
        ///
        /// </para>
        ///
        /// <para>
        /// You must specify exactly two of the following parameters: <code>startTime</code>,
        /// <code>period</code>, and <code>endTime</code>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetProfile service method.</param>
        ///
        /// <returns>The response from the GetProfile service method, as returned by CodeGuruProfiler.</returns>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.InternalServerException">
        /// The server encountered an internal error and is unable to complete the request.
        /// </exception>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.ResourceNotFoundException">
        /// The resource specified in the request does not exist.
        /// </exception>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.ThrottlingException">
        /// The request was denied due to request throttling.
        /// </exception>
        /// <exception cref="Amazon.CodeGuruProfiler.Model.ValidationException">
        /// The parameter is not valid.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/codeguruprofiler-2019-07-18/GetProfile">REST API Reference for GetProfile Operation</seealso>
        public virtual GetProfileResponse GetProfile(GetProfileRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetProfileRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetProfileResponseUnmarshaller.Instance;

            return(Invoke <GetProfileResponse>(request, options));
        }
예제 #21
0
 public Handle_Returns
 (
     WebApplicationFactory <Startup> aWebApplicationFactory,
     JsonSerializerOptions aJsonSerializerOptions
 ) : base(aWebApplicationFactory, aJsonSerializerOptions)
 {
     GetProfileRequest = new GetProfileRequest {
         ProfileId = "sample"
     };
 }
예제 #22
0
        private void StatusShare_RadioChanged(object sender, EventArgs e)
        {
            mBottomSheetDialog_StatusPhoto.Dismiss();
            var requestModel = new GetProfileRequest()
            {
                TOKEN = MyApplication.Me.TOKEN, USERID = Convert.ToString((sender as AppCompatRadioButton).Tag)
            };

            MyProfileViewModel.CommandUpdateStatusShareTo.Execute(requestModel);
        }
예제 #23
0
        /// <summary>
        /// Creates a waiter using the provided configuration.
        /// </summary>
        /// <param name="request">Request to send.</param>
        /// <param name="config">Wait Configuration</param>
        /// <param name="targetStates">Desired resource states. If multiple states are provided then the waiter will return once the resource reaches any of the provided states</param>
        /// <returns>a new Oci.common.Waiter instance</returns>
        public Waiter <GetProfileRequest, GetProfileResponse> ForProfile(GetProfileRequest request, WaiterConfiguration config, params LifecycleState[] targetStates)
        {
            var agent = new WaiterAgent <GetProfileRequest, GetProfileResponse>(
                request,
                request => client.GetProfile(request),
                response => targetStates.Contains(response.Profile.LifecycleState.Value),
                targetStates.Contains(LifecycleState.Deleted)
                );

            return(new Waiter <GetProfileRequest, GetProfileResponse>(config, agent));
        }
예제 #24
0
        /// <summary>
        /// Uses Personality Insights to get the source profile.
        /// </summary>
        /// <returns><c>true</c>, if profile was gotten, <c>false</c> otherwise.</returns>
        /// <param name="callback">Callback.</param>
        /// <param name="source">Json or Text source. Json data must follow the ContentListContainer Model.</param>
        /// <param name="contentType">Content mime type.</param>
        /// <param name="contentLanguage">Content language.</param>
        /// <param name="accept">Accept mime type.</param>
        /// <param name="acceptLanguage">Accept language.</param>
        /// <param name="includeRaw">If set to <c>true</c> include raw.</param>
        /// <param name="headers">If set to <c>true</c> headers.</param>
        /// <param name="data">Data.</param>
        public bool GetProfile(OnGetProfile callback, string source,
                               string contentType     = DataModels.ContentType.TEXT_PLAIN,
                               string contentLanguage = DataModels.Language.ENGLISH,
                               string accept          = DataModels.ContentType.APPLICATION_JSON,
                               string acceptLanguage  = DataModels.Language.ENGLISH,
                               bool includeRaw        = false,
                               bool headers           = false,
                               string data            = default(string))
        {
            if (callback == null)
            {
                throw new ArgumentNullException("callback");
            }
            if (string.IsNullOrEmpty(source))
            {
                throw new ArgumentNullException("A JSON or Text source is required for GetProfile!");
            }

            RESTConnector connector = RESTConnector.GetConnector(SERVICE_ID, SERVICE_GET_PROFILE);

            if (connector == null)
            {
                return(false);
            }

            GetProfileRequest req = new GetProfileRequest();

            req.Callback   = callback;
            req.OnResponse = GetProfileResponse;

            req.Parameters["include_raw"] = includeRaw.ToString();
            req.Parameters["headers"]     = headers.ToString();

            req.Headers["Content-Type"]     = contentType;
            req.Headers["Content-Language"] = contentLanguage;
            req.Headers["Accept"]           = accept;
            req.Headers["Accept-Language"]  = acceptLanguage;

            string normalizedSource = source.Trim().ToLower();

            if (Path.GetExtension(normalizedSource).EndsWith(".json"))
            {
                string jsonData = default(string);
                jsonData = File.ReadAllText(source);
                req.Send = System.Text.Encoding.UTF8.GetBytes(jsonData);
            }
            else
            {
                req.Send = System.Text.Encoding.UTF8.GetBytes(source);
            }

            return(connector.Send(req));
        }
예제 #25
0
        public void ShouldBeAbleToGetProfileIfEmailExists()
        {
            // arrange
            var service = new MembershipService(this.logger, this.emailService, this.userRepository, this.roleRepository, this.profileRepository, this.membershipRepository);
            var request = new GetProfileRequest { IdentityToken = "*****@*****.**" };

            // act
            var profile = service.GetProfile(request);

            // assert
            Assert.That(profile.FirstName, Is.EqualTo("Vitali"));
        }
예제 #26
0
        public async Task <ProfileDto> GetProfile(string profileIdentifier, CancellationToken cancellationToken = default)
        {
            var request = new GetProfileRequest(profileIdentifier);

            request.Headers.Authorization = GetAuthZHeader();

            var response = await SendAsync(request, cancellationToken);

            var profileDto = await response.Content.ReadFromJsonAsync <ProfileDto>(null, cancellationToken);

            return(profileDto);
        }
예제 #27
0
        public void Be_Valid()
        {
            var getProfileRequest = new GetProfileRequest
            {
                // Set Valid values here
                // #TODO
                ProfileId = "sample"
            };

            ValidationResult validationResult = GetProfileRequestValidator.TestValidate(getProfileRequest);

            validationResult.IsValid.Should().BeTrue();
        }
예제 #28
0
        public async Task <PublicUser> GetProfile(GetProfileRequest request)
        {
            using (HellolingoEntities db = new HellolingoEntities()) {
                User foundUser = await db.Users.FindAsync(request.Id);

                if (foundUser == null)
                {
                    Log.Error(LogTag.UserNotFoundForGetProfileRequest, Request, new { request });
                    return(null);
                }
                return(new PublicUser(foundUser));
            }
        }
예제 #29
0
        public void CanBeConstructed()
        {
            //Arrange
            GetProfileRequest sut;

            //Act
            sut = new GetProfileRequest("my-profile-id");

            //Assert
            Assert.NotNull(sut);
            Assert.Equal("6.1-preview.3", sut.ApiVersion);
            Assert.Equal(HttpMethod.Get, sut.Method);
            Assert.Equal("https://app.vssps.visualstudio.com/_apis/profile/profiles/my-profile-id?api-version=6.1-preview.3", sut.RequestUri.AbsoluteUri);
        }
 /// <summary>Snippet for GetProfile</summary>
 public void GetProfile_RequestObject()
 {
     // Snippet: GetProfile(GetProfileRequest,CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     GetProfileRequest request = new GetProfileRequest
     {
         Name = new ProfileName("[PROJECT]", "[COMPANY]", "[PROFILE]").ToString(),
     };
     // Make the request
     Profile response = profileServiceClient.GetProfile(request);
     // End snippet
 }
 /// <summary>Snippet for GetProfile</summary>
 public void GetProfileRequestObject()
 {
     // Snippet: GetProfile(GetProfileRequest, CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     GetProfileRequest request = new GetProfileRequest
     {
         ProfileName = ProfileName.FromProjectTenantProfile("[PROJECT]", "[TENANT]", "[PROFILE]"),
     };
     // Make the request
     Profile response = profileServiceClient.GetProfile(request);
     // End snippet
 }
예제 #32
0
        /// <summary>
        /// Get user's profile.
        /// </summary>
        /// <param name="request">
        /// The request.
        /// </param>
        /// <returns>
        /// Get profile response object.
        /// </returns>
        public GetProfileResponse GetProfile(GetProfileRequest request)
        {
            var response = new GetProfileResponse();
            var user = this.userRepository.GetUserByEmail(request.IdentityToken);
            if (user == null)
            {
                response.MessageType = MessageType.Error;
                response.ErrorCode = ErrorCode.UserNotFound.ToString();
                return response;
            }

            if (user.Profile == null)
            {
                response.MessageType = MessageType.Error;
                response.ErrorCode = ErrorCode.ProfileNotFound.ToString();
                return response;
            }

            response = user.ConvertToGetProfileResponse();
            response.WalletId = user.Wallet.Id;
            response.Balance = user.Wallet.Amount;
            return response;
        }
예제 #33
0
 /// <summary>
 /// Get user's profile.
 /// </summary>
 /// <param name="request">
 /// The request.
 /// </param>
 /// <returns>
 /// Get profile response object.
 /// </returns>
 public GetProfileResponse GetProfile(GetProfileRequest request)
 {
     return new GetProfileResponse();
 }
예제 #34
0
        public void ShouldNotBeAbleToGetProfileIfEmailDoesNotExist()
        {
            // arrange
            var service = new MembershipService(this.logger, this.emailService, this.userRepository, this.roleRepository, this.profileRepository, this.membershipRepository);
            var request = new GetProfileRequest { IdentityToken = "*****@*****.**" };

            // act
            var profile = service.GetProfile(request);

            // assert
            Assert.That(profile.MessageType, Is.EqualTo(MessageType.Error));
        }