public void WriteObject_Throws_CannotWriteType()
 {
     ODataWorkspaceSerializer serializer = new ODataWorkspaceSerializer();
     Assert.Throws<SerializationException>(
         () => serializer.WriteObject(42, _workspaceType, messageWriter: ODataTestUtil.GetMockODataMessageWriter(), writeContext: null),
         "ODataWorkspaceSerializer cannot write an object of type 'ODataWorkspace'.");
 }
 public void WriteObject_ThrowsArgumentNull_Graph()
 {
     ODataWorkspaceSerializer serializer = new ODataWorkspaceSerializer();
     Assert.ThrowsArgumentNull(
         () => serializer.WriteObject(null, type: _workspaceType, messageWriter: null, writeContext: null),
         "messageWriter");
 }
예제 #3
0
        public void WriteObject_Throws_CannotWriteType()
        {
            ODataWorkspaceSerializer serializer = new ODataWorkspaceSerializer();

            Assert.Throws <SerializationException>(
                () => serializer.WriteObject(42, _workspaceType, messageWriter: ODataTestUtil.GetMockODataMessageWriter(), writeContext: null),
                "ODataWorkspaceSerializer cannot write an object of type 'ODataWorkspace'.");
        }
예제 #4
0
        public void WriteObject_ThrowsArgumentNull_Graph()
        {
            ODataWorkspaceSerializer serializer = new ODataWorkspaceSerializer();

            Assert.ThrowsArgumentNull(
                () => serializer.WriteObject(null, type: _workspaceType, messageWriter: null, writeContext: null),
                "messageWriter");
        }
        public void ODataWorkspaceSerializer_Works()
        {
            // Arrange
            ODataWorkspaceSerializer serializer = new ODataWorkspaceSerializer();
            MemoryStream stream = new MemoryStream();
            IODataResponseMessage message = new ODataMessageWrapper(stream);

            // Act
            serializer.WriteObject(new ODataWorkspace(), _workspaceType, new ODataMessageWriter(message), new ODataSerializerContext());

            // Assert
            stream.Seek(0, SeekOrigin.Begin);
            XElement element = XElement.Load(stream);
            Assert.Equal("service", element.Name.LocalName);
        }
예제 #6
0
        public void ODataWorkspaceSerializer_Works()
        {
            // Arrange
            ODataWorkspaceSerializer serializer = new ODataWorkspaceSerializer();
            MemoryStream             stream     = new MemoryStream();
            IODataResponseMessage    message    = new ODataMessageWrapper(stream);

            // Act
            serializer.WriteObject(new ODataWorkspace(), _workspaceType, new ODataMessageWriter(message), new ODataSerializerContext());

            // Assert
            stream.Seek(0, SeekOrigin.Begin);
            XElement element = XElement.Load(stream);

            Assert.Equal("service", element.Name.LocalName);
        }