public void Test_SomeKnownValuesInWorld( string fileToLoad, int objectId, WorldObject.Type type, int x, int y, float m11, float m12, float m21, float m22 ) { JSONWorldSerializer serializer = GetSerializer(); World world = serializer.Load(fileToLoad); WorldObject knownObject = world.GetObjectByID(objectId); Assert.AreEqual(knownObject.X, x); Assert.AreEqual(knownObject.Y, y); Assert.AreEqual(knownObject.ObjectType, type); Assert.AreEqual(knownObject.Transformation_m11, m11); Assert.AreEqual(knownObject.Transformation_m12, m12); Assert.AreEqual(knownObject.Transformation_m21, m21); Assert.AreEqual(knownObject.Transformation_m22, m22); }
public void Test_WhenWorldNotModified_ThenInputOutputIsSame(string worldPath) { FileUtils fileUtils = new FileUtils(); string tmpFilePath = Path.GetTempFileName(); JSONWorldSerializer serializer = GetSerializer(); try { World world = serializer.Load(worldPath); serializer.Save(world, tmpFilePath); Assert.True(fileUtils.TextFilesEqual(worldPath, tmpFilePath)); } finally { File.Delete(tmpFilePath); } }
private static World MakeWorldWithJsonSerializer(string fileToLoad) { JSONWorldSerializer serializer = GetSerializer(); return(serializer.Load(fileToLoad)); }