/// <summary>Snippet for GetLoginProfile</summary> public void GetLoginProfile_RequestObject() { // Snippet: GetLoginProfile(GetLoginProfileRequest,CallSettings) // Create client OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.Create(); // Initialize request argument(s) GetLoginProfileRequest request = new GetLoginProfileRequest { UserName = new UserName("[USER]"), }; // Make the request LoginProfile response = osLoginServiceClient.GetLoginProfile(request); // End snippet }
/// <summary>Snippet for GetLoginProfileAsync</summary> public async Task GetLoginProfileAsync_RequestObject() { // Snippet: GetLoginProfileAsync(GetLoginProfileRequest,CallSettings) // Additional: GetLoginProfileAsync(GetLoginProfileRequest,CancellationToken) // Create client OsLoginServiceClient osLoginServiceClient = await OsLoginServiceClient.CreateAsync(); // Initialize request argument(s) GetLoginProfileRequest request = new GetLoginProfileRequest { UserName = new UserName("[USER]"), }; // Make the request LoginProfile response = await osLoginServiceClient.GetLoginProfileAsync(request); // End snippet }
public async Task GetLoginProfileAsync2() { Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); GetLoginProfileRequest request = new GetLoginProfileRequest { UserName = new UserName("[USER]"), }; LoginProfile expectedResponse = new LoginProfile { Name = "name2-1052831874", Suspended = false, }; mockGrpcClient.Setup(x => x.GetLoginProfileAsync(request, It.IsAny<CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall<LoginProfile>(Task.FromResult(expectedResponse), null, null, null, null)); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); LoginProfile response = await client.GetLoginProfileAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetLoginProfile2() { Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); GetLoginProfileRequest request = new GetLoginProfileRequest { UserName = new UserName("[USER]"), }; LoginProfile expectedResponse = new LoginProfile { Name = "name2-1052831874", Suspended = false, }; mockGrpcClient.Setup(x => x.GetLoginProfile(request, It.IsAny<CallOptions>())) .Returns(expectedResponse); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); LoginProfile response = client.GetLoginProfile(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public Task <GetLoginProfileResponse> GetLoginProfileAsync(GetLoginProfileRequest request, CancellationToken cancellationToken = new CancellationToken()) { throw new System.NotImplementedException(); }