Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonLdContextModule"/> class.
        /// </summary>
        /// <param name="pathProvider">@context path provider</param>
        /// <param name="provider">custom @context provider</param>
        public JsonLdContextModule(IContextPathMapper pathProvider, IContextProvider provider)
            : base(pathProvider.BasePath)
        {
            this.resolver = new ContextResolver(provider);

            foreach (var path in pathProvider.Contexts)
            {
                this.Get(path.Path, this.ServeContextOf(path.ModelType));
            }
        }
        public void Setup()
        {
            this.mapper = A.Fake <IContextPathMapper>();
            A.CallTo(() => this.mapper.BasePath).Returns("context");
            A.CallTo(() => this.mapper.Contexts).Returns(new[] { new ContextPathMap("staticString", typeof(Model)) });

            this.browser = new Browser(
                with => with.Module <JsonLdContextModule>()
                .Dependency(this.mapper)
                .Dependency(A.Dummy <IEntitySerializer>())
                .Dependency(A.Dummy <IContextProvider>()));
        }
 public void Setup()
 {
     this.entitySerializer = A.Fake <IEntitySerializer>();
     this.pathMapper       = A.Fake <IContextPathMapper>();
     this.serializer       = new JsonLdSerializer(this.entitySerializer, this.pathMapper);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonLdSerializer"/> class.
 /// </summary>
 public JsonLdSerializer(IEntitySerializer serializer, IContextPathMapper contextPathMapper)
 {
     this.serializer        = serializer;
     this.contextPathMapper = contextPathMapper;
 }