Beispiel #1
0
 public static void CreateConfigurationFile(string configurationPath, string mockBaseDirectory, string configurationContent)
 {
     Directory.CreateDirectory(mockBaseDirectory);
     using (var file = File.Create(Path.Combine(mockBaseDirectory, configurationPath)))
     {
         var info = new UTF8Encoding(true).GetBytes(configurationContent);
         file.Write(info, 0, info.Count());
     }
 }
Beispiel #2
0
        private static void FrenchEncoding()
        {
            using (var fs = new FileStream(@"c:\frenchcoding\frenchencoding.csv", FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                var preamble = new UTF8Encoding(true).GetPreamble();
                fs.Write(preamble,0,preamble.Count());

                var byteArrayLine1 = System.Text.Encoding.UTF8.GetBytes("courriel, nom, prénom"+Environment.NewLine);
                fs.Write(byteArrayLine1, 0, byteArrayLine1.Count());

                var byteArrayLine2 = System.Text.Encoding.UTF8.GetBytes("[email protected], Paradis, Pascal");
                fs.Write(byteArrayLine2, 0, byteArrayLine2.Count());
            }
        }
        private ConfigurationDefaults GetConfigurationDefaults(string configurationDefaultsContent)
        {
            var configurationDefaultsPath = "NuGetDefaults.config";
            var mockBaseDirectory = TestFilesystemUtility.CreateRandomTestFolder();
            Directory.CreateDirectory(mockBaseDirectory);

            using (var file = File.Create(Path.Combine(mockBaseDirectory, configurationDefaultsPath)))
            {
                var info = new UTF8Encoding(true).GetBytes(configurationDefaultsContent);
                file.Write(info, 0, info.Count());
            }
            return new ConfigurationDefaults(mockBaseDirectory, configurationDefaultsPath);
        }