コード例 #1
0
        public void DeserializeFromXml()
        {
            var xml = $"<{nameof(ServiceContractProtectionBehaviorExtension).ToCamelCase()} protectionLevel=\"EncryptAndSign\" />";
            var sut = new ServiceContractProtectionBehaviorExtensionSpy();

            sut.DeserializeFromXml(xml);
            sut.ProtectionLevel.Should().Be(ProtectionLevel.EncryptAndSign);
        }
コード例 #2
0
        public void SerializeToXml()
        {
            var xml = $"<{nameof(ServiceContractProtectionBehaviorExtension).ToCamelCase()} protectionLevel=\"Sign\" />";
            var sut = new ServiceContractProtectionBehaviorExtensionSpy {
                ProtectionLevel = ProtectionLevel.Sign
            };

            XDocument.Parse(sut.SerializeToXml()).Should().BeEquivalentTo(XDocument.Parse(xml));
        }