public void SerializeDictTest()
        {
            // Arrange
            var data       = SerializableDict;
            var serializer = new YamlEntitySerializer();

            serializer.EntityHeader();

            // Act
            serializer.DataField(ref data, "datadict", new Dictionary <string, int>(0));

            // Assert
            var result = NodeToYamlText(serializer.GetRootNode());

            Assert.That(result, Is.EqualTo(SerializedDictYaml));
        }
        public void SerializeListTest()
        {
            // Arrange
            var data       = SerializableList;
            var serializer = new YamlEntitySerializer();

            serializer.EntityHeader();

            // Act
            serializer.DataField(ref data, "datalist", new List <int>(0));

            // Assert
            var result = NodeToYamlText(serializer.GetRootNode());

            Assert.That(result, Is.EqualTo(SerializedListYaml));
        }
        public void DeserializeDictTest()
        {
            Dictionary <string, int> data = null;
            var rootNode   = YamlTextToNode(SerializedDictYaml);
            var serializer = new YamlEntitySerializer(rootNode);

            serializer.EntityHeader();

            // Act
            serializer.DataField(ref data, "datadict", new Dictionary <string, int>(0));

            // Assert
            Assert.That(data, Is.Not.Null);
            Assert.That(data.Count, Is.EqualTo(SerializableDict.Count));
            foreach (var kvEntry in SerializableDict)
            {
                Assert.That(data[kvEntry.Key], Is.EqualTo(kvEntry.Value));
            }
        }
        public void DeserializeListTest()
        {
            // Arrange
            List <int> data       = null;
            var        rootNode   = YamlTextToNode(SerializedListYaml);
            var        serializer = new YamlEntitySerializer(rootNode);

            serializer.EntityHeader();

            // Act
            serializer.DataField(ref data, "datalist", new List <int>(0));

            // Assert
            Assert.That(data, Is.Not.Null);
            Assert.That(data.Count, Is.EqualTo(SerializableList.Count));
            for (var i = 0; i < SerializableList.Count; i++)
            {
                Assert.That(data[i], Is.EqualTo(SerializableList[i]));
            }
        }