public void Can_save_test_assembly_path_in_project_file()
        {
            JesterProject project =
                new JesterProject("targetAssembly.dll", "testAssembly.dll");

            Assert.AreEqual("testAssembly.dll", project.TestAssemblyPath);
        }
        /// <summary>
        /// Serializes the specified project to the given location on disk.
        /// </summary>
        /// <param name="project">The project to be serialized.</param>
        /// <param name="path">The path where the project will be serialized to.</param>
        public void Serialize(JesterProject project, string path)
        {
            XmlWriter writer = XmlWriter.Create(path);

            _xmlSerializer.Serialize(writer, project);
            writer.Close();
        }
        /// <summary>
        /// Deserializes the project file found at the given path into a valid instance
        /// of <see cref="JesterProject"/>.
        /// </summary>
        /// <param name="path">The path of the project file.</param>
        /// <returns>A valid instance of <see cref="JesterProject"/> reconstituted from
        /// the given project file.</returns>
        public JesterProject Deserialize(string path)
        {
            XmlReader     reader  = XmlReader.Create(path);
            JesterProject project = (JesterProject)_xmlSerializer.Deserialize(reader);

            reader.Close();

            return(project);
        }
        public void Can_save_project_to_disk()
        {
            JesterProject project =
                new JesterProject("targetAssembly.dll", "testAssembly.dll");

            string savedFile = Path.GetTempFileName();

            JesterProjectSerializer serializer = new JesterProjectSerializer();
            serializer.Serialize(project, savedFile);

            FileAssert.Exists(savedFile);
        }
        /// <summary>
        /// Handles the Click event of the okButton control.  Sets the <see 
        /// cref="ProjectFilePath"/> property to the location of the new <see 
        /// cref="JesterProject"/> that the user has created.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the 
        /// event data.</param>
        private void okButton_Click(object sender, EventArgs e)
        {
            JesterProject project = new JesterProject(targetAssemblyTextBox.Text, testAssemblyTextBox.Text);
            _projectFilePath = saveAsTextBox.Text;

            JesterProjectSerializer serializer = new JesterProjectSerializer();
            serializer.Serialize(project, _projectFilePath);

            DialogResult = DialogResult.OK;
            Close();
        }