public void WriteUnknownFlagValueTest() { var value = (FlagEnum)10; var converter = new XmlEnumConverter(); Assert.Throws <FormatException>(() => converter.ToXml(value)); }
public void WriteEnumWithCustomContractTest() { var value = SimpleEnum.One; var converter = new XmlEnumConverter(); var actual = converter.ToXml(value, contract: GetCustomContract()); var expected = "<xml>1</xml>"; Assert.AreEqual(expected, actual); }
public void WriteFlagEnumWithCustomSeparatorTest() { var value = FlagEnum.Bit1 | FlagEnum.Bit2; var converter = new XmlEnumConverter(','); var actual = converter.ToXml(value); var expected = "<xml>bit1,bit2</xml>"; Assert.AreEqual(expected, actual); }
public void WriteEnumTest() { var value = SimpleEnum.One; var converter = new XmlEnumConverter(); var actual = converter.ToXml(value); var expected = "<xml>one</xml>"; Assert.AreEqual(expected, actual); }