public async Task UpdateProfileAsync2() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); UpdateProfileRequest request = new UpdateProfileRequest { 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.UpdateProfileAsync(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.UpdateProfileAsync(request); 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 async Task CreateProfileAsync() { 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.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); string formattedParent = new CompanyName("[PROJECT]", "[COMPANY]").ToString(); Profile profile = new Profile(); Profile response = await client.CreateProfileAsync(formattedParent, profile); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateProfile2() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); UpdateProfileRequest request = new UpdateProfileRequest { 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.UpdateProfile(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); Profile response = client.UpdateProfile(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetProfile() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); GetProfileRequest expectedRequest = new GetProfileRequest { Name = new ProfileName("[PROJECT]", "[COMPANY]", "[PROFILE]").ToString(), }; Profile expectedResponse = new Profile { Name = "name2-1052831874", ExternalId = "externalId-1153075697", Source = "source-896505829", Uri = "uri116076", GroupId = "groupId506361563", ResumeHrxml = "resumeHrxml1834730555", Processed = true, KeywordSnippet = "keywordSnippet1325317319", }; mockGrpcClient.Setup(x => x.GetProfile(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); string formattedName = new ProfileName("[PROJECT]", "[COMPANY]", "[PROFILE]").ToString(); Profile response = client.GetProfile(formattedName); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task DeleteProfileAsync2() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); DeleteProfileRequest request = new DeleteProfileRequest { ProfileName = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteProfileAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteProfileAsync(request); mockGrpcClient.VerifyAll(); }
public void DeleteProfile2() { Mock <ProfileService.ProfileServiceClient> mockGrpcClient = new Mock <ProfileService.ProfileServiceClient>(MockBehavior.Strict); DeleteProfileRequest request = new DeleteProfileRequest { ProfileName = new ProfileName("[PROJECT]", "[TENANT]", "[PROFILE]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteProfile(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ProfileServiceClient client = new ProfileServiceClientImpl(mockGrpcClient.Object, null); client.DeleteProfile(request); mockGrpcClient.VerifyAll(); }