public void Setup()
        {
            var serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder());

            codecContainer           = new CodecContainer();
            factory                  = new RawHandlerFactory(codecContainer);
            service                  = Substitute.For <IGlobalService>();
            globalServiceDescription = serviceDescriptionBuilder.Build(typeof(IGlobalService));
        }
Beispiel #2
0
        public void Setup()
        {
            codecContainer = new CodecContainer();
            factory        = new ServiceMethodHandlerFactory(codecContainer);
            service        = Substitute.For <IGlobalService>();
            var serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder());
            var globalServiceDescription  = serviceDescriptionBuilder.Build(typeof(IGlobalService));

            globalServiceImplementationInfo =
                new ServiceImplementationInfo(globalServiceDescription, service);
        }
        public void Trivial()
        {
            var serviceDescription = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()).Build(typeof(ITrivialService));
            var path    = new ServicePath("MyService", "MyMethod");
            var handler = Substitute.For <IHandler>();

            factory.CreateHandler(serviceDescription, path).Returns(handler);

            var handler1 = container.GetHandler(serviceDescription, path);
            var handler2 = container.GetHandler(serviceDescription, path);

            Assert.That(handler1, Is.EqualTo(handler2));
        }
        /// <inheritdoc />
        public virtual ServiceDescription CreateServiceDescription(Func <OperationDefinition, bool> operationFilter = null, uint?version = null)
        {
            if (!version.HasValue && ProtocolDefinition.SupportedVersions.Any())
            {
                throw new SchemaDefinitionException("Version value is required to generate service description.");
            }

            if (version.HasValue && !ProtocolDefinition.SupportedVersions.Contains(version.Value))
            {
                throw new SchemaDefinitionException($"Version {version.Value} is not supported.");
            }

            var producerDefinition = new ServiceDescriptionBuilder(schemaDefinitionProvider, operationFilter, version);

            return(producerDefinition.GetServiceDescription());
        }
Beispiel #5
0
 public void Setup()
 {
     methodDescriptionBuilder = Substitute.For <IMethodDescriptionBuilder>();
     builder = new ServiceDescriptionBuilder(methodDescriptionBuilder);
 }
Beispiel #6
0
 public void Setup()
 {
     rpcClientServer           = Substitute.For <IRpcClientServer>();
     serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder());
 }