Exemple #1
0
        public void GetSharedSet()
        {
            moq::Mock <SharedSetService.SharedSetServiceClient> mockGrpcClient = new moq::Mock <SharedSetService.SharedSetServiceClient>(moq::MockBehavior.Strict);
            GetSharedSetRequest request = new GetSharedSetRequest
            {
                ResourceNameAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"),
            };
            gagvr::SharedSet expectedResponse = new gagvr::SharedSet
            {
                ResourceNameAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"),
                Id             = -6774108720365892680L,
                Type           = gagve::SharedSetTypeEnum.Types.SharedSetType.NegativePlacements,
                SharedSetName  = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"),
                Status         = gagve::SharedSetStatusEnum.Types.SharedSetStatus.Enabled,
                MemberCount    = -5151590354343439845L,
                ReferenceCount = -8440758895662409664L,
            };

            mockGrpcClient.Setup(x => x.GetSharedSet(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            SharedSetServiceClient client   = new SharedSetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::SharedSet       response = client.GetSharedSet(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetSharedSet2()
        {
            Mock <SharedSetService.SharedSetServiceClient> mockGrpcClient = new Mock <SharedSetService.SharedSetServiceClient>(MockBehavior.Strict);
            GetSharedSetRequest request = new GetSharedSetRequest
            {
                ResourceName = new SharedSetName("[CUSTOMER]", "[SHARED_SET]").ToString(),
            };
            SharedSet expectedResponse = new SharedSet
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetSharedSet(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SharedSetServiceClient client = new SharedSetServiceClientImpl(mockGrpcClient.Object, null);
            SharedSet response            = client.GetSharedSet(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }