public void CreateProfile() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); CreateProfileRequest expectedRequest = new CreateProfileRequest { Parent = new CompanyName("[PROJECT]", "[COMPANY]").ToString(), Profile = new Profile(), }; Profile expectedResponse = new Profile { Name = "name3373707", ExternalId = "externalId-1153075697", Source = "source-896505829", Uri = "uri116076", GroupId = "groupId506361563", ResumeHrxml = "resumeHrxml1834730555", Processed = true, KeywordSnippet = "keywordSnippet1325317319", }; mockGrpcClient.Setup(x => x.CreateProfile(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); string formattedParent = new CompanyName("[PROJECT]", "[COMPANY]").ToString(); Profile profile = new Profile(); Profile response = client.CreateProfile(formattedParent, profile); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task <ProfileResponse> CreateProfileAsync(CreateProfileRequest model) { var profile = UnitOfWork.UserProfileRepository.Query(x => x.UserId == model.UserId) .FirstOrDefault(); if (profile != null) { return(profile.ToProfileResponse()); } var newProfile = new UserProfile { Id = Guid.NewGuid(), Email = model.Email, FirstName = model.FirstName, LastName = model.LastName, SearchFullName = model.FirstName?.ToLower() + model.LastName?.ToLower(), GroupId = model.GroupId, UserId = model.UserId }; UnitOfWork.UserProfileRepository.Add(newProfile); await UnitOfWork.SaveChangesAsync(); return(newProfile.ToProfileResponse()); }
public async Task CreateProfileAsync() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); CreateProfileRequest expectedRequest = new CreateProfileRequest { ParentAsTenantName = new TenantName("[PROJECT]", "[TENANT]"), Profile = new 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.CreateProfileAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Profile>(Task.FromResult(expectedResponse), null, null, null, null)); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); TenantName parent = new TenantName("[PROJECT]", "[TENANT]"); Profile profile = new Profile(); Profile response = await client.CreateProfileAsync(parent, profile); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateProfileRequestObject() { moq::Mock <ProfilerService.ProfilerServiceClient> mockGrpcClient = new moq::Mock <ProfilerService.ProfilerServiceClient>(moq::MockBehavior.Strict); CreateProfileRequest request = new CreateProfileRequest { Deployment = new Deployment(), ProfileType = { ProfileType.Contention, }, Parent = "parent7858e4d0", }; Profile expectedResponse = new Profile { Name = "name1c9368b0", ProfileType = ProfileType.Contention, Deployment = new Deployment(), Duration = new wkt::Duration(), ProfileBytes = proto::ByteString.CopyFromUtf8("profile_bytes12d9894a"), Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.CreateProfile(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ProfilerServiceClient client = new ProfilerServiceClientImpl(mockGrpcClient.Object, null); Profile response = client.CreateProfile(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateProfile2() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); CreateProfileRequest request = new CreateProfileRequest { ParentAsTenantName = new TenantName("[PROJECT]", "[TENANT]"), Profile = new 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.CreateProfile(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); Profile response = client.CreateProfile(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
//....// ============================================================================================= public int InsertProfile(CreateProfileRequest model) { int id = 0; try { DataProvider.ExecuteNonQuery(GetConnection, "dbo.UserProfile_Insert" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@userId", model.UserId); paramCollection.AddWithValue("@firstName", model.FirstName); paramCollection.AddWithValue("@lastName", model.LastName); paramCollection.AddWithValue("@userRole", model.userRole); paramCollection.AddWithValue("@name", model.CompanyName); paramCollection.AddWithValue("@phoneNumber", model.PhoneNumber); SqlParameter p = new SqlParameter("@id", System.Data.SqlDbType.Int); p.Direction = System.Data.ParameterDirection.Output; paramCollection.Add(p); }, returnParameters : delegate(SqlParameterCollection param) { int.TryParse(param["@id"].Value.ToString(), out id); }); } catch (Exception ex) { throw ex; } return(id); }
public ActionResult CreateProfile(CreateProfileModel model) { if (!ModelState.IsValid) { return View(CreateViewModel()); } var request = new CreateProfileRequest(User.Identity.Name, model.Name, model.Location, model.Sports, model.SkillLevel); var handler = new CreateProfileRequestHandle(new SportRepository(), new LocationRepository(), new ProfileRepository(), new ProfileBuilder()); var response = handler.Handle(request); if (response.Status == ResponseCodes.Success) { return RedirectToAction("ChooseProfile"); } var errorMessage = response.Status.GetMessage(); ModelState.AddModelError("", errorMessage); return View(CreateViewModel()); }
public void CanBeHandledWithOnlyName() { CreateMockRepositories(); var request = new CreateProfileRequest("AccountId", "Bob"); var handler = CreateProfileRequestHandler(); var response = handler.Handle(request); Assert.NotNull(response); }
public CreateProfileRequest Build() { var result = JsonConvert.DeserializeObject <CreateProfileRequest>(JsonConvert.SerializeObject(_profileRequest)); _profileRequest = Reset(result.BaseProfileId); return(result); }
public async Task <Profile> PostCreateNewProfile([FromBody] CreateProfileRequest createProfileRequest) { Profile profile = new Profile(); profile.IdAccount = int.Parse(User.Claims.FirstOrDefault(claim => claim.Type == "IdAccount").Value); profile.Username = createProfileRequest.Username; return(await _profileRepository.CreateNewProfile(profile)); }
public CreateProfileResponse CreateProfile(CreateProfileRequest createProfileRequest) { Customer customer = _adaptee.CreateProfile(createProfileRequest.Email, createProfileRequest.CustomerId); return(new CreateProfileResponse() { CustomerId = customer.Id }); }
public async Task <CreateProfileResponse> Create([FromBody] CreateProfileRequest request) { var profile = await profileRepository.Create(request.Name, request.ProfileTypeId, ApiUser.Id); return(new CreateProfileResponse() { Success = profile != null && profile.Id != 0 }); }
public void CreatingNameWithEmptyStringThrowsNotEnoughInfoException() { CreateMockRepositories(); var request = new CreateProfileRequest("AccountId", ""); var handler = CreateProfileRequestHandler(); var response = handler.Handle(request); Assert.That(response.Status, Is.EqualTo(ResponseCodes.NameNotSpecified)); }
// CreateUser public MonetaSdkResult sdkMonetaCreateUser(string firstName, string lastName, string email, string gender) { MonetaSdkResult result = new MonetaSdkResult(); try { if (String.Compare(gender, "MALE") != 0 && String.Compare(gender, "FEMALE") != 0) { gender = "MALE"; } CreateProfileRequest request = new CreateProfileRequest(); List <KeyValueApprovedAttribute> mntAttributes = new List <KeyValueApprovedAttribute>(); KeyValueApprovedAttribute monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "first_name"; monetaAtribute.value = firstName; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "last_name"; monetaAtribute.value = lastName; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "email_for_notifications"; monetaAtribute.value = email; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "sex"; monetaAtribute.value = gender; mntAttributes.Add(monetaAtribute); request.profile = mntAttributes.ToArray(); String mntPrototype = basicSettings.GetSetting("BasicSettings", "monetasdk_prototype_user_unit_id"); if (String.Compare(mntPrototype, "") != 0) { request.unitId = (long)Convert.ToDouble(mntPrototype); request.unitIdSpecified = true; } request.profileType = ProfileType.client; response = client.CreateProfile(request); result = prepareResult(); } catch (Exception e) { result.error = true; result.errorMessage = e.Message; } return(result); }
public void AddsProfileToCurrentUserLogin() { CreateMockRepositories(); var request = new CreateProfileRequest("AccountId", "Happy Days"); var handler = CreateProfileRequestHandler(); handler.Handle(request); Assert.That(_profile.AccountName, Is.EqualTo("AccountId")); }
public MonetaSdkResult sdkMonetaCreateProfile(long unitId, long profileId) { MonetaSdkResult result = new MonetaSdkResult(); try { CreateProfileRequest request = new CreateProfileRequest(); request.profileId = profileId; request.profileIdSpecified = true; request.unitId = unitId; request.unitIdSpecified = true; request.profileType = ProfileType.client; List <KeyValueApprovedAttribute> mntAttributes = new List <KeyValueApprovedAttribute>(); KeyValueApprovedAttribute monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "first_name"; monetaAtribute.value = "first_name"; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "last_name"; monetaAtribute.value = "last_name"; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "email_for_notifications"; monetaAtribute.value = "email_for_notifications"; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "sex"; monetaAtribute.value = "MALE"; mntAttributes.Add(monetaAtribute); monetaAtribute = new KeyValueApprovedAttribute(); monetaAtribute.key = "childprofiletypeid"; monetaAtribute.value = "DIRECTOR"; mntAttributes.Add(monetaAtribute); request.profile = mntAttributes.ToArray(); response = client.CreateProfile(request); result = prepareResult(); } catch (Exception e) { result.error = true; result.errorMessage = e.Message; } return(result); }
public async Task <IActionResult> Post([FromForm] CreateProfileRequest model) { var result = await _userProfilesService.CreateProfileAsync(model); if (result.IsSuccess) { return(Ok(result)); } return(BadRequest(result)); }
public HttpResponseMessage ProfileInsert(CreateProfileRequest model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <bool> response = new ItemResponse <bool>(); response.Item = _UserProfileService.UpdateProfile(model); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public void ChecksToSeeIfProfileNameIsAlreadyInUse() { CreateMockRepositories(); const string accountName = "NoProfiles"; var request = new CreateProfileRequest(accountName, "MyAccount"); _mockProfileRepo.Setup(x => x.GetByAccount(accountName)).Returns(new List<Profile>()); _mockProfileRepo.Setup(x => x.ProfileExistsWithName(request.ProfileId)).Returns(true); var handler = CreateProfileRequestHandler(); var response = handler.Handle(request); Assert.That(response.Status, Is.EqualTo(ResponseCodes.ProfileNameAlreadyExists)); }
/// <summary>Snippet for CreateProfile</summary> public void CreateProfileRequestObject() { // Snippet: CreateProfile(CreateProfileRequest, CallSettings) // Create client ProfileServiceClient profileServiceClient = ProfileServiceClient.Create(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"), Profile = new Profile(), }; // Make the request Profile response = profileServiceClient.CreateProfile(request); // End snippet }
/// <summary>Snippet for CreateProfile</summary> public void CreateProfile_RequestObject() { // Snippet: CreateProfile(CreateProfileRequest,CallSettings) // Create client ProfileServiceClient profileServiceClient = ProfileServiceClient.Create(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { ParentAsCompanyName = new CompanyName("[PROJECT]", "[COMPANY]"), Profile = new Profile(), }; // Make the request Profile response = profileServiceClient.CreateProfile(request); // End snippet }
public void DoesNotGoToSportOrLocationRepositoryIfNullRequest() { CreateMockRepositories(); const string accountName = "NoProfiles"; var request = new CreateProfileRequest(accountName, "MyAccount"); request.Location = null; request.Sports = null; _mockProfileRepo.Setup(x => x.GetByAccount(accountName)).Returns(new List<Profile>()); var handler = CreateProfileRequestHandler(); var response = handler.Handle(request); Assert.That(response.Status, Is.EqualTo(ResponseCodes.Success)); _mockSportRepo.Verify(x => x.FindByName(It.IsAny<string>()), Times.Never()); _mockLocationRepo.Verify(x => x.FindByName(It.IsAny<string>()), Times.Never()); }
/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileRequestObjectAsync() { // Snippet: CreateProfileAsync(CreateProfileRequest, CallSettings) // Additional: CreateProfileAsync(CreateProfileRequest, CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"), Profile = new Profile(), }; // Make the request Profile response = await profileServiceClient.CreateProfileAsync(request); // End snippet }
public HttpResponseMessage UpdateProfile(CreateProfileRequest model) { //- validate incoming payload model if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } // Create and call a UpdateProfile method in the userService bool isSuccessful = _UserProfileService.UpdateProfile(model); // Load the response Item with the success boolean (true). ItemResponse <bool> response = new ItemResponse <bool> { Item = isSuccessful }; return(Request.CreateResponse(HttpStatusCode.OK, response)); }
/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileAsync_RequestObject() { // Snippet: CreateProfileAsync(CreateProfileRequest,CallSettings) // Additional: CreateProfileAsync(CreateProfileRequest,CancellationToken) // Create client ProfileServiceClient profileServiceClient = await ProfileServiceClient.CreateAsync(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { Parent = new CompanyName("[PROJECT]", "[COMPANY]").ToString(), Profile = new Profile(), }; // Make the request Profile response = await profileServiceClient.CreateProfileAsync(request); // End snippet }
public async Task <IActionResult> CreateProfileAsync([FromBody] CreateProfileRequest request) { var user = await _userService.GetUserAsync(User); var result = await _userService.CreateProfileAsync( user, request.FirstName, request.LastName, request.Gender.ToEnumeration <Gender>()); if (result.IsValid) { return(this.Ok(_mapper.Map <ProfileDto>(result.Response))); } result.AddToModelState(ModelState); return(this.BadRequest(new ValidationProblemDetails(ModelState))); }
/// <summary>Snippet for CreateProfile</summary> public void CreateProfileRequestObject() { // Snippet: CreateProfile(CreateProfileRequest, CallSettings) // Create client ProfilerServiceClient profilerServiceClient = ProfilerServiceClient.Create(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { Deployment = new Deployment(), ProfileType = { ProfileType.Unspecified, }, Parent = "", }; // Make the request Profile response = profilerServiceClient.CreateProfile(request); // End snippet }
public void Given_A_Create_Profile_Request__When_Calling_Create__Correct_Profile_Data_Is_Returned() { // Arrange var createRequest = new CreateProfileRequest { Username = "******", Bio = "Bio", DisplayName = "Display Name", ImageUrl = "link" }; // Act var profile = Profile.Create(createRequest); // Assert Assert.AreEqual(createRequest.Username, profile.Username); Assert.AreEqual(createRequest.DisplayName, profile.DisplayName); Assert.AreEqual(createRequest.Bio, profile.Bio); Assert.AreEqual(createRequest.ImageUrl, profile.ImageUrl); }
/// <summary>Snippet for CreateProfileAsync</summary> public async Task CreateProfileRequestObjectAsync() { // Snippet: CreateProfileAsync(CreateProfileRequest, CallSettings) // Additional: CreateProfileAsync(CreateProfileRequest, CancellationToken) // Create client ProfilerServiceClient profilerServiceClient = await ProfilerServiceClient.CreateAsync(); // Initialize request argument(s) CreateProfileRequest request = new CreateProfileRequest { Deployment = new Deployment(), ProfileType = { ProfileType.Unspecified, }, Parent = "", }; // Make the request Profile response = await profilerServiceClient.CreateProfileAsync(request); // End snippet }
public async Task <IActionResult> Create([FromBody] CreateProfileRequest profileRequest) { var newProfileId = Guid.NewGuid(); var profile = new Profile { ProfileId = newProfileId, FirstName = profileRequest.FirstName, LastName = profileRequest.LastName, AvatarUrl = "https://www.civhc.org/wp-content/uploads/2018/10/question-mark.png", RegisterDate = DateTime.Now, //VocabularyCount = _vocabularies.GetProfileVocabularyCount(); VocabularyCount = 0, //RatePosition = _vocabularyRatings.GetProfileRatingPosition(); RatePosition = 0, LocationCity = profileRequest.LocationCity, LocationCountry = profileRequest.LocationCountry, //TotalWordsCount = _vocabularies.GetTotalWordsCount(); // Actually we can at it with LINQ TotalWordsCount = 0, //Level = _userRatings.GetUserRatingById(profileId); Level = 0 //As well we need to use Claims and assign UserId value with current user ID }; await _profiles.CreateProfile(profile); //I cant come up with situation we can use it but let it be var baseUrl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}"; var locationUrl = baseUrl + "/" + ApiRoutes.Profiles.Get.Replace("{profileId}", profile.ProfileId.ToString()); var response = new ProfileResponse { FirstName = profile.FirstName, LastName = profile.LastName }; return(Created(locationUrl, response)); }
private async Task SaveProfile() { try { // Create a new profile var request = new CreateProfileRequest() { Name = ProfileName, Passphrase = ProfilePassphrase, ConfirmPassphrase = ConfirmProfilePassphrase }; // Call api to create the profile. var profile = await KryptPadApi.CreateProfileAsync(request); // Go to profile await KryptPadApi.LoadProfileAsync(profile, ProfilePassphrase); // Success, tell the app we are signed in (App.Current as App).SignInStatus = SignInStatus.SignedInWithProfile; // Redirect to the main item list page NavigationHelper.Navigate(typeof(ItemsPage), null, NavigationHelper.NavigationType.Main); // Hide the dialog Hide(); } catch (WebException ex) { // Something went wrong in the api await DialogHelper.ShowMessageDialogAsync(ex.Message); } catch (Exception ex) { // Failed await DialogHelper.ShowGenericErrorDialogAsync(ex); } }
public async stt::Task CreateProfileRequestObjectAsync() { moq::Mock <ProfilerService.ProfilerServiceClient> mockGrpcClient = new moq::Mock <ProfilerService.ProfilerServiceClient>(moq::MockBehavior.Strict); CreateProfileRequest request = new CreateProfileRequest { Deployment = new Deployment(), ProfileType = { ProfileType.Contention, }, Parent = "parent7858e4d0", }; Profile expectedResponse = new Profile { Name = "name1c9368b0", ProfileType = ProfileType.Contention, Deployment = new Deployment(), Duration = new wkt::Duration(), ProfileBytes = proto::ByteString.CopyFromUtf8("profile_bytes12d9894a"), Labels = { { "key8a0b6e3c", "value60c16320" }, }, }; mockGrpcClient.Setup(x => x.CreateProfileAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Profile>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ProfilerServiceClient client = new ProfilerServiceClientImpl(mockGrpcClient.Object, null); Profile responseCallSettings = await client.CreateProfileAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Profile responseCancellationToken = await client.CreateProfileAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
protected override void ProcessRecord() { base.ProcessRecord(); CreateProfileRequest request; try { request = new CreateProfileRequest { CreateProfileDetails = CreateProfileDetails, OpcRequestId = OpcRequestId, OpcRetryToken = OpcRetryToken }; response = client.CreateProfile(request).GetAwaiter().GetResult(); WriteOutput(response, response.Profile); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public async Task <ActionResult <FullProfile> > CreateProfile(CreateProfileRequest request) { if (!request.IsValid(out var error)) { return(BadRequest(error)); } try { Profile profile = request.ToProfile(); await _profileService.AddProfile(profile); return(CreatedAtAction(nameof(GetProfile), request.Username, await _profileService.GetFullProfile(profile))); } catch (DuplicateProfileException e) { return(Conflict(e.Message)); } catch (EmployerNotFoundException e) { return(NotFound(e.Message)); } }
//....// ============================================================================================= public bool UpdateProfile(CreateProfileRequest model) { bool result = false; try { DataProvider.ExecuteNonQuery(GetConnection, "dbo.UserProfile_Update" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@userId", model.UserId); paramCollection.AddWithValue("@firstName", model.FirstName); paramCollection.AddWithValue("@lastName", model.LastName); paramCollection.AddWithValue("@phoneNumber", model.PhoneNumber); paramCollection.AddWithValue("@mediaId", model.mediaId); result = true; }); } catch (Exception ex) { throw ex; } return(result); }
public void ReturnsIfAccountAlreadyHasMaxProfiles() { CreateMockRepositories(); const string accountName = "NoProfiles"; _mockProfileRepo.Setup(x => x.GetByAccount(accountName)) .Returns(new List<Profile> { new Profile(), new Profile(), new Profile()}); var request = new CreateProfileRequest(accountName, "MyAccount"); var handler = CreateProfileRequestHandler(); var response = handler.Handle(request); Assert.That(response.Status, Is.EqualTo(ResponseCodes.MaxProfilesReached)); }
/// <summary> /// CreateProfile creates a new profile resource in the online mode. /// /// The server ensures that the new profiles are created at a constant rate per /// deployment, so the creation request may hang for some time until the next /// profile session is available. /// /// The request may fail with ABORTED error if the creation is not available /// within ~1m, the response will indicate the duration of the backoff the /// client should take before attempting creating a profile again. The backoff /// duration is returned in google.rpc.RetryInfo extension on the response /// status. To a gRPC client, the extension will be return as a /// binary-serialized proto in the trailing metadata item named /// "google.rpc.retryinfo-bin". /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <Profile> CreateProfileAsync(CreateProfileRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_CreateProfileRequest(ref request, ref callSettings); return(_callCreateProfile.Async(request, callSettings)); }
public void ResponseContainsAPerson() { CreateMockRepositories(); var request = new CreateProfileRequest("AccountId", "Simon Taylor", "location", "Soccer", "10"); var handler = CreateProfileRequestHandler(); var response = handler.Handle(request); Assert.NotNull(response); Assert.That(response.Status, Is.EqualTo(ResponseCodes.Success)); }