public void DeletePosixAccount() { Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); DeletePosixAccountRequest expectedRequest = new DeletePosixAccountRequest { ProjectName = new ProjectName("[USER]", "[PROJECT]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeletePosixAccount(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); ProjectName name = new ProjectName("[USER]", "[PROJECT]"); client.DeletePosixAccount(name); mockGrpcClient.VerifyAll(); }
public async Task DeletePosixAccountAsync() { Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); DeletePosixAccountRequest expectedRequest = new DeletePosixAccountRequest { ProjectName = new ProjectName("[USER]", "[PROJECT]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeletePosixAccountAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); ProjectName name = new ProjectName("[USER]", "[PROJECT]"); await client.DeletePosixAccountAsync(name); mockGrpcClient.VerifyAll(); }
public void DeleteSshPublicKey() { Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); DeleteSshPublicKeyRequest expectedRequest = new DeleteSshPublicKeyRequest { FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteSshPublicKey(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); FingerprintName name = new FingerprintName("[USER]", "[FINGERPRINT]"); client.DeleteSshPublicKey(name); mockGrpcClient.VerifyAll(); }
public async Task DeleteSshPublicKeyAsync() { Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); DeleteSshPublicKeyRequest expectedRequest = new DeleteSshPublicKeyRequest { FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteSshPublicKeyAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); FingerprintName name = new FingerprintName("[USER]", "[FINGERPRINT]"); await client.DeleteSshPublicKeyAsync(name); mockGrpcClient.VerifyAll(); }
public async Task ImportSshPublicKeyAsync3() { Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); ImportSshPublicKeyRequest request = new ImportSshPublicKeyRequest { ParentAsUserName = new UserName("[USER]"), SshPublicKey = new SshPublicKey(), }; ImportSshPublicKeyResponse expectedResponse = new ImportSshPublicKeyResponse(); mockGrpcClient.Setup(x => x.ImportSshPublicKeyAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ImportSshPublicKeyResponse>(Task.FromResult(expectedResponse), null, null, null, null)); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); ImportSshPublicKeyResponse response = await client.ImportSshPublicKeyAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ImportSshPublicKey3() { Mock <OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock <OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); ImportSshPublicKeyRequest request = new ImportSshPublicKeyRequest { ParentAsUserName = new UserName("[USER]"), SshPublicKey = new SshPublicKey(), }; ImportSshPublicKeyResponse expectedResponse = new ImportSshPublicKeyResponse(); mockGrpcClient.Setup(x => x.ImportSshPublicKey(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); ImportSshPublicKeyResponse response = client.ImportSshPublicKey(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
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 void ImportSshPublicKey2() { Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); ImportSshPublicKeyRequest expectedRequest = new ImportSshPublicKeyRequest { ParentAsUserName = new UserName("[USER]"), SshPublicKey = new SshPublicKey(), ProjectId = "projectId-1969970175", }; ImportSshPublicKeyResponse expectedResponse = new ImportSshPublicKeyResponse(); mockGrpcClient.Setup(x => x.ImportSshPublicKey(expectedRequest, It.IsAny<CallOptions>())) .Returns(expectedResponse); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); UserName parent = new UserName("[USER]"); SshPublicKey sshPublicKey = new SshPublicKey(); string projectId = "projectId-1969970175"; ImportSshPublicKeyResponse response = client.ImportSshPublicKey(parent, sshPublicKey, projectId); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetSshPublicKeyAsync2() { Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); GetSshPublicKeyRequest request = new GetSshPublicKeyRequest { FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"), }; SshPublicKey expectedResponse = new SshPublicKey { Key = "key106079", ExpirationTimeUsec = 2058878882L, Fingerprint = "fingerprint-1375934236", }; mockGrpcClient.Setup(x => x.GetSshPublicKeyAsync(request, It.IsAny<CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall<SshPublicKey>(Task.FromResult(expectedResponse), null, null, null, null)); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); SshPublicKey response = await client.GetSshPublicKeyAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateSshPublicKey3() { Mock<OsLoginService.OsLoginServiceClient> mockGrpcClient = new Mock<OsLoginService.OsLoginServiceClient>(MockBehavior.Strict); UpdateSshPublicKeyRequest request = new UpdateSshPublicKeyRequest { FingerprintName = new FingerprintName("[USER]", "[FINGERPRINT]"), SshPublicKey = new SshPublicKey(), }; SshPublicKey expectedResponse = new SshPublicKey { Key = "key106079", ExpirationTimeUsec = 2058878882L, Fingerprint = "fingerprint-1375934236", }; mockGrpcClient.Setup(x => x.UpdateSshPublicKey(request, It.IsAny<CallOptions>())) .Returns(expectedResponse); OsLoginServiceClient client = new OsLoginServiceClientImpl(mockGrpcClient.Object, null); SshPublicKey response = client.UpdateSshPublicKey(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }