public void SerializeOutput_Test()
        {
            var output = new Output
            {
                SumResult = 30.30m,
                MulResult = 4,
                SortedInputs = new[] {1m, 1.01m, 2.02m, 4m}
            };

            var exceptedObj = "{\"SumResult\":30.30,\"MulResult\":4,\"SortedInputs\":[1.0,1.01,2.02,4.0]}";
            var jsonBaseSerializer = new JsonBaseSerializer<Output>();
            var jsonOutput = jsonBaseSerializer.Serialize(output);
            Assert.AreEqual(exceptedObj, jsonOutput);
        }
        public void SerializeOutput_Test()
        {
            var output = new Output
            {
                SumResult = 30.30m,
                MulResult = 4,
                SortedInputs = new[] { 1m, 1.01m, 2.02m, 4m }
            };

            var exceptedObj = "<Output><SumResult>30.30</SumResult><MulResult>4</MulResult><SortedInputs><decimal>1</decimal><decimal>1.01</decimal><decimal>2.02</decimal><decimal>4</decimal></SortedInputs></Output>";
            var xmlSerializer = new XmlBaseSerializer<Output>();
            var xmlObj = xmlSerializer.Serialize(output);
            Assert.AreEqual(exceptedObj, xmlObj);
        }
Exemplo n.º 3
0
        public void ConvertInputToOutput_Test()
        {
            var input = new Input
            {
                K = 10,
                Sums = new[] { 1.01m, 2.02m },
                Muls = new[] { 1, 4 }
            };

            var exceptedOutput = new Output
            {
                SumResult = 30.30m,
                MulResult = 4,
                SortedInputs = new[] { 1m, 1.01m, 2.02m, 4m }
            };

            var output = _ioAdapter.Convert(input);
            Assert.AreEqual(exceptedOutput, output);
        }