public void AssertAirplaneSaved() { AirplaneStorage storage = new AirplaneStorage(PATH_TEST); // Create Airplane Model ArrayList waypoints = new ArrayList(); waypoints.Add(new Vector3(0.0f, 0.0f, 1000.0f)); waypoints.Add(new Vector3(100.0f, 100.0f, 1000.0f)); AirplaneModel airplaneModel = new AirplaneModel(1, "test", Utilities.parseToString(waypoints)); // Save the model in file storage.Save(airplaneModel); // Load the airplane ArrayList result = storage.Load(); // Assert that the number of airplanes model is 1 Debug.Log(result.Count); // Assert AirplaneModel attributes with the first AirplaneModel in file AirplaneModel resultModel = (AirplaneModel)result [0]; Assert.That(resultModel.id == airplaneModel.id); Assert.That(resultModel.name == airplaneModel.name); Assert.That(resultModel.waypoints == airplaneModel.waypoints); }
public void AssertAirplaneInserted() { AirplaneStorage storage = new AirplaneStorage(PATH_TEST); // Create Airplane Model ArrayList waypoints = new ArrayList(); waypoints.Add(new Vector3(0.0f, 0.0f, 1000.0f)); waypoints.Add(new Vector3(100.0f, 100.0f, 1000.0f)); AirplaneModel airplaneModel = new AirplaneModel(1, "test", Utilities.parseToString(waypoints)); // Save the model in file storage.Save(airplaneModel); // Update Airplane Model string name = "updatedTest"; waypoints [0] = new Vector3(50.0f, 50.0f, 1000.0f); airplaneModel = new AirplaneModel(1, name, Utilities.parseToString(waypoints)); // Update it in File storage.Insert(airplaneModel); // Load the airplane ArrayList result = storage.Load(); // Assert AirplaneModel attributes with the first AirplaneModel in file AirplaneModel resultModel = (AirplaneModel)result [0]; Assert.That(resultModel.id == airplaneModel.id); Assert.That(resultModel.name == airplaneModel.name); Assert.That(resultModel.waypoints == airplaneModel.waypoints); }