Example #1
0
        public void TransformVarSavedCorrectly()
        {
            // Arrange
            var correctSave = new TransformVarData(flowchartTransVar.Value);
            var gameSave    = gameSaver.CreateSave();

            // Act
            var saved = FindDataIn(gameSave);

            // Assert
            bool savedCorrectly = correctSave.Equals(saved);

            Assert.IsTrue(savedCorrectly);
        }
Example #2
0
        public void TransformVarSerializedCorrectly()
        {
            // Arrange
            // Create the save data
            TransformVarData save = CreateTransformVarData();

            // Act
            // Try saving it to a json
            string json = JsonUtility.ToJson(save, true);
            // Deserialize from that json
            TransformVarData deserializedSave = JsonUtility.FromJson <TransformVarData>(json);

            // Assert
            // See if both the original and deserialized version have the same data
            bool deserializedCorrectly = save.Equals(deserializedSave);

            Assert.IsTrue(deserializedCorrectly);
        }