public void GetWorkloadResourceNames() { moq::Mock <AssuredWorkloadsService.AssuredWorkloadsServiceClient> mockGrpcClient = new moq::Mock <AssuredWorkloadsService.AssuredWorkloadsServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetWorkloadRequest request = new GetWorkloadRequest { WorkloadName = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"), }; Workload expectedResponse = new Workload { WorkloadName = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"), DisplayName = "display_name137f65c2", Resources = { new Workload.Types.ResourceInfo(), }, ComplianceRegime = Workload.Types.ComplianceRegime.FedrampHigh, CreateTime = new wkt::Timestamp(), BillingAccount = "billing_account2062abb6", #pragma warning disable CS0612 Il4Settings = new Workload.Types.IL4Settings(), CjisSettings = new Workload.Types.CJISSettings(), #pragma warning restore CS0612 Etag = "etage8ad7218", Labels = { { "key8a0b6e3c", "value60c16320" }, }, #pragma warning disable CS0612 FedrampHighSettings = new Workload.Types.FedrampHighSettings(), FedrampModerateSettings = new Workload.Types.FedrampModerateSettings(), #pragma warning restore CS0612 ProvisionedResourcesParent = "provisioned_resources_parent4d000dc9", KmsSettings = new Workload.Types.KMSSettings(), ResourceSettings = { new Workload.Types.ResourceSettings(), }, KajEnrollmentState = Workload.Types.KajEnrollmentState.Unspecified, EnableSovereignControls = true, SaaEnrollmentResponse = new Workload.Types.SaaEnrollmentResponse(), }; mockGrpcClient.Setup(x => x.GetWorkload(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssuredWorkloadsServiceClient client = new AssuredWorkloadsServiceClientImpl(mockGrpcClient.Object, null); Workload response = client.GetWorkload(request.WorkloadName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetWorkloadResourceNames() { moq::Mock <AssuredWorkloadsService.AssuredWorkloadsServiceClient> mockGrpcClient = new moq::Mock <AssuredWorkloadsService.AssuredWorkloadsServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetWorkloadRequest request = new GetWorkloadRequest { WorkloadName = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"), }; Workload expectedResponse = new Workload { WorkloadName = WorkloadName.FromOrganizationLocationWorkload("[ORGANIZATION]", "[LOCATION]", "[WORKLOAD]"), DisplayName = "display_name137f65c2", Resources = { new Workload.Types.ResourceInfo(), }, ComplianceRegime = Workload.Types.ComplianceRegime.FedrampHigh, CreateTime = new wkt::Timestamp(), BillingAccount = "billing_account2062abb6", Il4Settings = new Workload.Types.IL4Settings(), CjisSettings = new Workload.Types.CJISSettings(), Etag = "etage8ad7218", Labels = { { "key8a0b6e3c", "value60c16320" }, }, FedrampHighSettings = new Workload.Types.FedrampHighSettings(), FedrampModerateSettings = new Workload.Types.FedrampModerateSettings(), }; mockGrpcClient.Setup(x => x.GetWorkload(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssuredWorkloadsServiceClient client = new AssuredWorkloadsServiceClientImpl(mockGrpcClient.Object, null); Workload response = client.GetWorkload(request.WorkloadName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }