Exemplo n.º 1
0
        public void BeforeAll()
        {
            _server = new Server
            {
                Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
            };

            _server.Services.AddTrackedFilteredService(
                new TrackedFilteredService(),
                options =>
            {
                options.ServiceProvider = new Mock <IServiceProvider>().Object;
                options.Filters.Add(1, _ => new MockServerFilter());
            });

            var clientFactory = new ClientFactory();

            clientFactory.AddFilteredServiceClient();

            _channel      = new GrpcChannel("localhost", Port, ChannelCredentials.Insecure);
            DomainService = clientFactory.CreateClient <IFilteredService>(_channel);

            _server.Start();
        }