コード例 #1
0
 public void TwoDictionariesWhereOneHasOneEntryExtra_ShouldBeFalse()
 {
     _dictionary1["test1"] = "value1";
     _dictionary1["test2"] = "value2";
     _dictionary2["test1"] = "value1";
     AttributesComparer.Equals(_dictionary1, _dictionary2).Should().BeFalse();
 }
コード例 #2
0
 /// <summary>
 /// Method is used to extract controllers' data from specified source file into ControllersTable 
 /// </summary>
 /// <returns>true if essential changes in controllers' declarations were detected,
 /// else - otherwise</returns>
 public bool FillControllerInfo()
 {
     TextReader rd = new StreamReader(srcFilename);
     controllerInfo.Clear();
     Extract(rd.ReadToEnd(), "<source>");
     if (parseTree == null) return false;
     AddParseNodeRec(parseTree.Root,false);
     //if source file has been recently added to the project,add new row into ControllersTable
     //else if there were any changes in source file,update corresponding row in ControllersTable
     if (!infobyFiles.ContainsKey(srcFilename))
     {
         ControllersTable curtbl = new ControllersTable(controllerInfo);
         infobyFiles.Add(srcFilename, curtbl);
         return true;
     }
     else
     {
         bool equal = new AttributesComparer().Equals(infobyFiles[srcFilename], controllerInfo);
         if (!equal)
         {
             if (infobyFiles.Remove(srcFilename))
             {
                 ControllersTable curtbl = new ControllersTable(controllerInfo);
                 infobyFiles.Add(srcFilename, curtbl);
                 return true;
             }
         }
         return false;
     }
 }
コード例 #3
0
 public void TwoDictionariesWithEachTwoEqualEntries_ShouldBeEqual()
 {
     _dictionary1["test1"] = "value1";
     _dictionary1["test2"] = "value2";
     _dictionary2["test1"] = "value1";
     _dictionary2["test2"] = "value2";
     AttributesComparer.Equals(_dictionary1, _dictionary2).Should().BeTrue();
 }
コード例 #4
0
 public void TwoDictionariesWhereMostEntriesAreEqualButTheUnequalEntriesAreExcludedByKey_ShouldBeTrue()
 {
     _dictionary1["test1"] = "value1";
     _dictionary1["test2"] = "value2";
     _dictionary2["test1"] = "w sfqffqf";
     _dictionary2["test2"] = "value2";
     AttributesComparer.Equals(_dictionary1, _dictionary2, new[] { "test1" }).Should().BeTrue();
 }
        public void Process(
                IPsiSourceFile sourceFile, IRangeMarker rangeMarker,
                CodeCleanupProfile profile, IProgressIndicator progressIndicator) {
            var settingsStore = sourceFile.GetSettingsStore();
            var settings = settingsStore.GetKey<XamlAttributeOrderingSettings>(SettingsOptimization.OptimizeDefault);
            if (!profile.GetSetting(DescriptorInstance) || !settings.Enable) {
                return;
            }

            foreach (var xamlFile in sourceFile.GetPsiFiles<XamlLanguage>().OfType<IXamlFile>()) {
                sourceFile.GetPsiServices().Transactions.Execute("Code cleanup",
                        () => {
                            var comparer = new AttributesComparer(settings);
                            xamlFile.ProcessDescendants(new ReorderAttributesProcessor(comparer));
                        });
            }
        }
コード例 #6
0
 public void TwoEmptyDictionaries_ShouldBeEqual()
 {
     AttributesComparer.Equals(_dictionary1, _dictionary2).Should().BeTrue();
 }