protected override void Given()
        {
            var registry = new Registry(null);
            var registeredGraph = new RegisteredGraph<IsolatedClass>(registry);
            subject = new JsonSerializer<IsolatedClass>(registeredGraph);

            graph = new IsolatedClass {AProperty = "test property"};
            session = Substitute.For<ISerializationSession>();
        }
コード例 #2
0
        protected override void Given()
        {
            session = Substitute.For<ISerializationSession>();
            var backingStore = Substitute.For<IBackingStore>();
            var registry = new Registry(backingStore);
            registry.RegisterGraph<IsolatedClass>();
            registry.RegisterGraph<ComposingClass>();
            subject = new JsonSerializer<ComposingClass>((IRegisteredGraph<ComposingClass>)registry.RegisteredGraphs[typeof(ComposingClass)]);

            isolatedGraph = new IsolatedClass {AProperty = "test property"};
            composingGraph = new ComposingClass {AnotherProperty = "another property", Composed = isolatedGraph};
            expectedInternalId = new InternalId(Guid.NewGuid());

            session.InternalIdOfTrackedGraph(isolatedGraph).Returns(expectedInternalId);
        }
コード例 #3
0
        protected override void Given()
        {
            session = Substitute.For<ISerializationSession>();
            var backingStore = Substitute.For<IBackingStore>();
            var registry = new Registry(backingStore);
            registry.RegisterGraph<IsolatedClass>();
            registry.RegisterGraph<ComposingClass>();
            subject = new JsonSerializer<ComposingClass>((IRegisteredGraph<ComposingClass>)registry.RegisteredGraphs[typeof(ComposingClass)]);

            expectedInternalId = new InternalId(Guid.NewGuid());

            jsonSource = @"{""Composed"":{""__StashInternalId"":""" + expectedInternalId + @"""},""AnotherProperty"":""another property""}";
            serialised = new PreservedMemoryStream();
            using(var sw = new StreamWriter(serialised))
                sw.Write(jsonSource);

            expected = new IsolatedClass();

            session.TrackedGraphForInternalId(expectedInternalId).Returns(expected);
        }