public async stt::Task CreateSchemaRequestObjectAsync() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); CreateSchemaRequest request = new CreateSchemaRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Schema = new Schema(), SchemaId = "schema_idb515cf80", }; Schema expectedResponse = new Schema { SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), Type = Schema.Types.Type.Unspecified, Definition = "definition3b8b6130", }; mockGrpcClient.Setup(x => x.CreateSchemaAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Schema>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); Schema responseCallSettings = await client.CreateSchemaAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Schema responseCancellationToken = await client.CreateSchemaAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void DeleteSchemaResourceNames() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); DeleteSchemaRequest request = new DeleteSchemaRequest { SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteSchema(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); client.DeleteSchema(request.SchemaName); mockGrpcClient.VerifyAll(); }
public void ValidateSchemaResourceNames() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); ValidateSchemaRequest request = new ValidateSchemaRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Schema = new Schema(), }; ValidateSchemaResponse expectedResponse = new ValidateSchemaResponse { }; mockGrpcClient.Setup(x => x.ValidateSchema(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); ValidateSchemaResponse response = client.ValidateSchema(request.ParentAsProjectName, request.Schema); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteSchemaResourceNamesAsync() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); DeleteSchemaRequest request = new DeleteSchemaRequest { SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteSchemaAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteSchemaAsync(request.SchemaName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteSchemaAsync(request.SchemaName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public void ValidateMessageRequestObject() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); ValidateMessageRequest request = new ValidateMessageRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), Schema = new Schema(), Message = proto::ByteString.CopyFromUtf8("message0231e778"), Encoding = Encoding.Json, }; ValidateMessageResponse expectedResponse = new ValidateMessageResponse { }; mockGrpcClient.Setup(x => x.ValidateMessage(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); ValidateMessageResponse response = client.ValidateMessage(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task ValidateSchemaResourceNamesAsync() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); ValidateSchemaRequest request = new ValidateSchemaRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Schema = new Schema(), }; ValidateSchemaResponse expectedResponse = new ValidateSchemaResponse { }; mockGrpcClient.Setup(x => x.ValidateSchemaAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ValidateSchemaResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); ValidateSchemaResponse responseCallSettings = await client.ValidateSchemaAsync(request.ParentAsProjectName, request.Schema, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ValidateSchemaResponse responseCancellationToken = await client.ValidateSchemaAsync(request.ParentAsProjectName, request.Schema, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetSchemaResourceNames() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); GetSchemaRequest request = new GetSchemaRequest { SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), }; Schema expectedResponse = new Schema { SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), Type = Schema.Types.Type.Unspecified, Definition = "definition3b8b6130", }; mockGrpcClient.Setup(x => x.GetSchema(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); Schema response = client.GetSchema(request.SchemaName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateSchema() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); CreateSchemaRequest request = new CreateSchemaRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Schema = new Schema(), SchemaId = "schema_idb515cf80", }; Schema expectedResponse = new Schema { SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), Type = Schema.Types.Type.Unspecified, Definition = "definition3b8b6130", }; mockGrpcClient.Setup(x => x.CreateSchema(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); Schema response = client.CreateSchema(request.Parent, request.Schema, request.SchemaId); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task ValidateMessageRequestObjectAsync() { moq::Mock <SchemaService.SchemaServiceClient> mockGrpcClient = new moq::Mock <SchemaService.SchemaServiceClient>(moq::MockBehavior.Strict); ValidateMessageRequest request = new ValidateMessageRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), SchemaName = SchemaName.FromProjectSchema("[PROJECT]", "[SCHEMA]"), Schema = new Schema(), Message = proto::ByteString.CopyFromUtf8("message0231e778"), Encoding = Encoding.Json, }; ValidateMessageResponse expectedResponse = new ValidateMessageResponse { }; mockGrpcClient.Setup(x => x.ValidateMessageAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ValidateMessageResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SchemaServiceClient client = new SchemaServiceClientImpl(mockGrpcClient.Object, null); ValidateMessageResponse responseCallSettings = await client.ValidateMessageAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ValidateMessageResponse responseCancellationToken = await client.ValidateMessageAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }