Example #1
0
        virtual public ResourceObject Unserialize(byte[] bytes)
        {
            Schema.Context context    = Context.Unknown;
            ByteBuffer     bb         = FileUnserializer.Load(bytes, out context);
            IUnserializer  serializer = Create(context);

            if (serializer != null)
            {
                ResourceObject resourceObject = serializer.Parse(bb);
                serializer = null;
                return(resourceObject);
            }
            return(null);
        }
Example #2
0
        public void GetContext(
            [Frozen] Mock <IHttpClient> httpClientMock,
            [Greedy] ContextComponent sut,
            string name,
            Schema.Context context)
        {
            // ARRANGE
            var json = JObject.FromObject(context);

            httpClientMock.SetupApiCall(sut, CallType.View, "context",
                                        new Parameters
            {
                { "contextName", name }
            })
            .Returns(json.ToString())
            .Verifiable();

            // ACT
            var result = sut.GetContext(name);

            // ASSERT
            result.ShouldBeEquivalentTo(context);
            httpClientMock.Verify();
        }