예제 #1
0
        public void EncodeTest1(double input)
        {
            Dictionary <string, object> encoderSettings = getDefaultSettings();

            TestEncoder encoder = new TestEncoder(encoderSettings);

            var result = encoder.Encode(input);

            Assert.IsTrue(result.Length == 2);

            Assert.IsTrue(result[0] == Convert.ToInt32(input) + 1);

            Assert.IsTrue(result[1] == 1);
        }
예제 #2
0
        public void EncoderInitTest1()
        {
            Dictionary <string, object> encoderSettings = getDefaultSettings();

            // We change here value of Name property.
            encoderSettings["Name"] = "hello";

            // We add here new property.
            encoderSettings.Add("TestProp1", "hello");

            var encoder = new TestEncoder();

            // Settings can also be passed by invoking Initialize(sett)
            encoder.Initialize(encoderSettings);

            // Property can also be set this way.
            encoder["abc"] = "1";

            Assert.IsTrue((string)encoder["TestProp1"] == "hello");

            Assert.IsTrue((string)encoder["Name"] == "hello");

            Assert.IsTrue((string)encoder["abc"] == "1");
        }