Пример #1
0
        public void AddTextToFileTest()
        {
            string lMyLine   = "This is my line of text";
            string aFileName = Path.Combine(Directory.GetCurrentDirectory(), "Test.txt");

            try
            {
                using (StreamWriter lWriter = new StreamWriter(new FileStream(aFileName, FileMode.Create)))
                {
                    lWriter.WriteLine("add lines of text");
                    lWriter.WriteLine("here");
                    lWriter.Flush();
                    lWriter.Close();
                }

                VisualStudio_Delphi_ConverterWizard_DelphiToVisualStudioAccessor.AddTextToFile(lMyLine, aFileName);
            }
            finally
            {
                if (File.Exists(aFileName))
                {
                    File.Delete(aFileName);
                }
            }
        }
Пример #2
0
        public void AddRegistryValueTest()
        {
            string aKey = "SOFTWARE\\Microsoft\\VisualStudio\\8.0Exp"; // TODO: Initialize to an appropriate value

            string aName = "MyTestKeyName";                            // TODO: Initialize to an appropriate value

            string aValue = "MyTestKeyValue";                          // TODO: Initialize to an appropriate value

            VisualStudio_Delphi_ConverterWizard_DelphiToVisualStudioAccessor.AddRegistryValue(aKey, aName, aValue);
            string lresult = VisualStudio_Delphi_ConverterWizard_DelphiToVisualStudioAccessor.GetRegistryValue(aKey, aName);

            VisualStudio_Delphi_ConverterWizard_DelphiToVisualStudioAccessor.DeleteRegistryValue(aKey, aName);
            Assert.AreEqual(aValue, lresult, "Key value did not save");
        }