コード例 #1
0
        public void WriteElementExtensions_Invoke_ReturnsExpected(string version)
        {
            var document = new ServiceDocumentSubclass();

            CompareHelper.AssertEqualWriteOutput("", writer => document.WriteElementExtensionsEntryPoint(writer, version));

            document.ElementExtensions.Add(new ExtensionObject {
                Value = 10
            });
            document.ElementExtensions.Add(new ExtensionObject {
                Value = 11
            });
            CompareHelper.AssertEqualWriteOutput(
                @"<ServiceDocumentTests.ExtensionObject xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://schemas.datacontract.org/2004/07/System.ServiceModel.Syndication.Tests"">
    <Value>10</Value>
</ServiceDocumentTests.ExtensionObject>
<ServiceDocumentTests.ExtensionObject xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://schemas.datacontract.org/2004/07/System.ServiceModel.Syndication.Tests"">
    <Value>11</Value>
</ServiceDocumentTests.ExtensionObject>", writer => document.WriteElementExtensionsEntryPoint(writer, version));
        }
コード例 #2
0
        public void WriteElementExtensions_NullWriter_ThrowsArgumentNullException()
        {
            var document = new ServiceDocumentSubclass();

            AssertExtensions.Throws <ArgumentNullException>("writer", () => document.WriteElementExtensionsEntryPoint(null, "version"));
        }