public void TestSaveMethod() { CameraFile cameraFile = new CameraFile(); cameraFile.Load(TEST_FILE); MemoryStream savedStream = new MemoryStream(); cameraFile.Save(savedStream); savedStream.Seek(0, SeekOrigin.Begin); CameraFile savedCameraFile = new CameraFile(); savedCameraFile.Load(savedStream); savedStream.Close(); Assert.AreEqual(cameraFile.ProjectionType, savedCameraFile.ProjectionType, "Projection types do not match"); Assert.AreEqual(cameraFile.ModelView, savedCameraFile.ModelView, "Model view matrices do not match"); Assert.AreEqual(cameraFile.Projection, savedCameraFile.Projection, "Projection matrices do not match"); Assert.AreEqual(cameraFile.FieldOfView, savedCameraFile.FieldOfView, "Field of view values do not match"); Assert.AreEqual(cameraFile.AspectRatio, savedCameraFile.AspectRatio, "Aspect ratio values do not match"); Assert.AreEqual(cameraFile.NearPlane, savedCameraFile.NearPlane, "Near plane values do not match"); Assert.AreEqual(cameraFile.FarPlane, savedCameraFile.FarPlane, "Far plane values do not match"); Assert.AreEqual(cameraFile.Eye, savedCameraFile.Eye, "Eye positions do not match"); Assert.AreEqual(cameraFile.Center, savedCameraFile.Center, "Center position do not match"); Assert.AreEqual(cameraFile.Up, savedCameraFile.Up, "Up positions do not match"); }
public void SaveFile(int index, string filename) { if (filename == null) { return; } //check if the directory exists if (!Directory.Exists(Path.GetDirectoryName(filename))) { throw new Exception(String.Format("Directory \"{0}\"does not exist", filename)); //FIXME } using (CameraFile camfile = GetFile(index)) { if (camfile == null) { throw new Exception("Unable to claim file"); //FIXME } camfile.Save(filename); } }