public async stt::Task ListAsync() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); ListSslCertificatesRequest request = new ListSslCertificatesRequest { Project = "projectaa6ff846", }; SslCertificateList expectedResponse = new SslCertificateList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new SslCertificate(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SslCertificateList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); SslCertificateList responseCallSettings = await client.ListAsync(request.Project, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); SslCertificateList responseCancellationToken = await client.ListAsync(request.Project, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void ListRequestObject() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); ListSslCertificatesRequest request = new ListSslCertificatesRequest { PageToken = "page_tokenf09e5538", MaxResults = 2806814450U, Filter = "filtere47ac9b2", OrderBy = "order_byb4d33ada", Project = "projectaa6ff846", ReturnPartialSuccess = false, }; SslCertificateList expectedResponse = new SslCertificateList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new SslCertificate(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); SslCertificateList response = client.List(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void List() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); ListSslCertificatesRequest request = new ListSslCertificatesRequest { Project = "projectaa6ff846", }; SslCertificateList expectedResponse = new SslCertificateList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { new SslCertificate(), }, SelfLink = "self_link7e87f12d", }; mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); SslCertificateList response = client.List(request.Project); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteRequestObjectAsync() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); DeleteSslCertificateRequest request = new DeleteSslCertificateRequest { RequestId = "request_id362c8df6", SslCertificate = "ssl_certificate25650c52", Project = "projectaa6ff846", }; Operation expectedResponse = new Operation { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", User = "******", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", StartTime = "start_timebd8dd9c4", OperationGroupId = "operation_group_idd2040cf0", TargetLink = "target_link9b435dc0", Progress = 278622268, Error = new Error(), EndTime = "end_time89285d30", Region = "regionedb20d96", OperationType = "operation_typeece9e153", Status = Operation.Types.Status.Pending, HttpErrorMessage = "http_error_messageb5ef3c7f", TargetId = 6263187990225347157UL, ClientOperationId = "client_operation_id4e51b631", StatusMessage = "status_message2c618f86", HttpErrorStatusCode = 1766362655, Description = "description2cf9da67", InsertTime = "insert_time7467185a", SelfLink = "self_link7e87f12d", Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.DeleteAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); Operation responseCallSettings = await client.DeleteAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Operation responseCancellationToken = await client.DeleteAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void InsertRequestObject() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); InsertSslCertificateRequest request = new InsertSslCertificateRequest { RequestId = "request_id362c8df6", SslCertificateResource = new SslCertificate(), Project = "projectaa6ff846", }; Operation expectedResponse = new Operation { Id = "id74b70bb8", Kind = "kindf7aa39d9", Name = "name1c9368b0", User = "******", Zone = "zone255f4ea8", CreationTimestamp = "creation_timestamp235e59a1", StartTime = "start_timebd8dd9c4", OperationGroupId = "operation_group_idd2040cf0", TargetLink = "target_link9b435dc0", Progress = 278622268, Error = new Error(), EndTime = "end_time89285d30", Region = "regionedb20d96", OperationType = "operation_typeece9e153", Status = Operation.Types.Status.Pending, HttpErrorMessage = "http_error_messageb5ef3c7f", TargetId = "target_id16dfe255", ClientOperationId = "client_operation_id4e51b631", StatusMessage = "status_message2c618f86", HttpErrorStatusCode = 1766362655, Description = "description2cf9da67", InsertTime = "insert_time7467185a", SelfLink = "self_link7e87f12d", Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.Insert(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); Operation response = client.Insert(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task AggregatedListRequestObjectAsync() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); AggregatedListSslCertificatesRequest request = new AggregatedListSslCertificatesRequest { PageToken = "page_tokenf09e5538", MaxResults = 2806814450U, Filter = "filtere47ac9b2", IncludeAllScopes = false, OrderBy = "order_byb4d33ada", Project = "projectaa6ff846", ReturnPartialSuccess = false, }; SslCertificateAggregatedList expectedResponse = new SslCertificateAggregatedList { Id = "id74b70bb8", Kind = "kindf7aa39d9", Warning = new Warning(), NextPageToken = "next_page_tokendbee0940", Items = { { "key8a0b6e3c", new SslCertificatesScopedList() }, }, SelfLink = "self_link7e87f12d", Unreachables = { "unreachables3ca950ee", }, }; mockGrpcClient.Setup(x => x.AggregatedListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SslCertificateAggregatedList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); SslCertificateAggregatedList responseCallSettings = await client.AggregatedListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); SslCertificateAggregatedList responseCancellationToken = await client.AggregatedListAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task GetRequestObjectAsync() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSslCertificateRequest request = new GetSslCertificateRequest { SslCertificate = "ssl_certificate25650c52", Project = "projectaa6ff846", }; SslCertificate expectedResponse = new SslCertificate { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Type = SslCertificate.Types.Type.Unspecified, CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", Managed = new SslCertificateManagedSslCertificate(), SelfManaged = new SslCertificateSelfManagedSslCertificate(), Certificate = "certificateef0cd3e0", PrivateKey = "private_key33176a15", Description = "description2cf9da67", ExpireTime = "expire_timece1cc25c", SelfLink = "self_link7e87f12d", SubjectAlternativeNames = { "subject_alternative_names2036b37b", }, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SslCertificate>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); SslCertificate responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); SslCertificate responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetRequestObject() { moq::Mock <SslCertificates.SslCertificatesClient> mockGrpcClient = new moq::Mock <SslCertificates.SslCertificatesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSslCertificateRequest request = new GetSslCertificateRequest { SslCertificate = "ssl_certificate25650c52", Project = "projectaa6ff846", }; SslCertificate expectedResponse = new SslCertificate { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", Type = "typee2cc9d59", CreationTimestamp = "creation_timestamp235e59a1", Region = "regionedb20d96", Managed = new SslCertificateManagedSslCertificate(), SelfManaged = new SslCertificateSelfManagedSslCertificate(), Certificate = "certificateef0cd3e0", PrivateKey = "private_key33176a15", Description = "description2cf9da67", ExpireTime = "expire_timece1cc25c", SelfLink = "self_link7e87f12d", SubjectAlternativeNames = { "subject_alternative_names2036b37b", }, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SslCertificatesClient client = new SslCertificatesClientImpl(mockGrpcClient.Object, null); SslCertificate response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }