Uses FileRepresentation attribute on enum values to encode/decode. If not present it uses the enum value.ToString().
Inheritance: FileHelpers.ConverterBase
コード例 #1
0
        public void To_transaction_code()
        {
            // Arrange
            var c = new EnumConverter(typeof(TransactionCode));

            // Act
            var result = c.StringToField("50");

            // Assert
            Assert.AreEqual(TransactionCode.CreditItem, result);
        }
コード例 #2
0
        public void From_transaction_code()
        {
            // Arrange
            var c = new EnumConverter(typeof(TransactionCode));

            // Act
            var result = c.FieldToString(TransactionCode.CreditItem);

            // Assert
            Assert.AreEqual("50", result);
        }
コード例 #3
0
        public void To_indicator()
        {
            // Arrange
            var c = new EnumConverter(typeof(Indicator));

            // Act
            var result = c.StringToField("X");

            // Assert
            Assert.AreEqual(Indicator.DividendPaid, result);
        }
コード例 #4
0
        public void From_indicator()
        {
            // Arrange
            var c = new EnumConverter(typeof(Indicator));

            // Act
            var result = c.FieldToString(Indicator.NewOrVaried);

            // Assert
            Assert.AreEqual("N", result);
        }