public void TestSetGlobalProperties() { extractor.SetGlobalProperty("Configuration", "Release"); Assert.AreEqual(6, extractor.AllFoundProperties.Count()); var allprops = (from p in extractor.AllFoundProperties let pl = p.Key orderby pl ascending select pl).ToList(); Assert.AreEqual("AssemblyName", allprops[0]); Assert.AreEqual("Configuration", allprops[1]); Assert.AreEqual("OutputPath", allprops[2]); Assert.AreEqual("Platform", allprops[3]); Assert.AreEqual("TheType", allprops[4]); Assert.AreEqual("UniqueforRelease", allprops[5]); // Assert counts too var props = extractor.AllFoundProperties; Assert.AreEqual(3, props["AssemblyName"].UsedCount); Assert.AreEqual(3, props["Configuration"].UsedCount); Assert.AreEqual(3, props["OutputPath"].UsedCount); Assert.AreEqual(3, props["Platform"].UsedCount); Assert.AreEqual(3, props["TheType"].UsedCount); Assert.AreEqual(1, props["UniqueforRelease"].UsedCount); Assert.AreEqual("Configuration", props["Configuration"].Name); Assert.AreEqual("OutputPath", props["OutputPath"].Name); Assert.AreEqual("Platform", props["Platform"].Name); Assert.AreEqual("TheType", props["TheType"].Name); Assert.AreEqual("UniqueforRelease", props["UniqueforRelease"].Name); var configVals = props["Configuration"].PropertyValues; Assert.AreEqual(1, configVals.Keys.Count); Assert.IsTrue(configVals.ContainsKey("release")); Assert.AreEqual(3, configVals["release"].Count); var typeVals = props["TheType"].PropertyValues; Assert.AreEqual(1, typeVals.Keys.Count); Assert.IsTrue(typeVals.ContainsKey("release")); Assert.AreEqual(3, typeVals["release"].Count); var assemblyName = props["AssemblyName"].PropertyValues; Assert.AreEqual(3, assemblyName.Keys.Count); Assert.IsTrue(assemblyName.ContainsKey("a")); Assert.IsTrue(assemblyName.ContainsKey("b")); Assert.IsTrue(assemblyName.ContainsKey("c")); Assert.AreEqual(1, assemblyName["a"].Count); Assert.AreEqual(1, assemblyName["b"].Count); Assert.AreEqual(1, assemblyName["c"].Count); }
public void UpdateConfigSelection() { model.SetGlobalProperty("Configuration", SelectedConfiguration); OnPropertyChanged("PropSheetProperties"); }
static void Main(string[] args) { var timer = new Stopwatch(); timer.Start(); if (args.Length != 4) { Console.WriteLine("RefactorConsole <input_dir> <property_sheet> <config> <platform>"); return; } string inputDir = args[0]; if (!Directory.Exists(inputDir)) { Console.WriteLine("Input directory doesn't exist: {0}", inputDir); return; } string propSheet = args[1]; if (!File.Exists(propSheet)) { Console.WriteLine("Input property sheet file doesn't exist: {0}", propSheet); return; } string config = args[2]; string platform = args[3]; bool verbose = true; var refactor = new PropertyExtractor(inputDir, config, platform, verbose); refactor.PropertySheetPath = propSheet; timer.Stop(); Console.WriteLine("{0} files", refactor.CountFoundFiles); Console.WriteLine("{0} files valid", refactor.Count); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Change configuration property"); timer.Restart(); refactor.SetGlobalProperty("Configuration", "Release"); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Moving a property"); timer.Restart(); refactor.Move("OutputPath", "$(BuildDir)"); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Change configuration property"); timer.Restart(); refactor.SetGlobalProperty("Configuration", "Debug"); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Moving a property"); timer.Restart(); refactor.Move("OutputPath", "$(BuildDir)"); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Removing a random property"); timer.Restart(); refactor.Remove("Optimize"); refactor.Move("ProjectType", "local"); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Saving the files"); timer.Restart(); refactor.SaveAll(); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); Console.WriteLine("Print Found Properties"); timer.Restart(); refactor.PrintFoundProperties(); timer.Stop(); Utils.WL(ConsoleColor.DarkYellow, String.Format("Elapsed Time: {0}\n", timer.Elapsed)); }