public void GetEntitlementRequestObject() { moq::Mock <CloudChannelService.CloudChannelServiceClient> mockGrpcClient = new moq::Mock <CloudChannelService.CloudChannelServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetEntitlementRequest request = new GetEntitlementRequest { EntitlementName = EntitlementName.FromAccountCustomerEntitlement("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]"), }; Entitlement expectedResponse = new Entitlement { EntitlementName = EntitlementName.FromAccountCustomerEntitlement("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]"), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), OfferAsOfferName = OfferName.FromAccountOffer("[ACCOUNT]", "[OFFER]"), CommitmentSettings = new CommitmentSettings(), ProvisioningState = Entitlement.Types.ProvisioningState.Unspecified, ProvisionedService = new ProvisionedService(), SuspensionReasons = { Entitlement.Types.SuspensionReason.TrialEnded, }, PurchaseOrderId = "purchase_order_id4111e034", TrialSettings = new TrialSettings(), AssociationInfo = new AssociationInfo(), Parameters = { new Parameter(), }, }; mockGrpcClient.Setup(x => x.GetEntitlement(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CloudChannelServiceClient client = new CloudChannelServiceClientImpl(mockGrpcClient.Object, null); Entitlement response = client.GetEntitlement(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetEntitlement</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetEntitlementRequestObject() { // Create client CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.Create(); // Initialize request argument(s) GetEntitlementRequest request = new GetEntitlementRequest { EntitlementName = EntitlementName.FromAccountCustomerEntitlement("[ACCOUNT]", "[CUSTOMER]", "[ENTITLEMENT]"), }; // Make the request Entitlement response = cloudChannelServiceClient.GetEntitlement(request); }