public override bool CollectReportData() { Boolean result = false; try { // productInfoItems.Clear(); //List<String> test = InputConnectionInfo.DatabaseFields; foreach (ManagementObject mo in searcher.Get().AsParallel()) { QuickFixInfo productInfo = new QuickFixInfo() { }; foreach (String itemProp in InputConnectionInfo.WMIFields) { productInfo.GetType().GetProperty(itemProp).SetValue(productInfo, (WMIQueryBuilder.GetValue(mo, itemProp)), null); } productInfo.TimeStamp = InputConnectionInfo.TimeStamp; productInfo.SystemName = MachineDetails.ServerName; UpdateStatus(productInfo.HotFixID); productInfoItems.Add(productInfo); if (IsCancelRequested) { break; } } result = true; } catch (Exception ex) { AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error); } return(result); }
public void CollapsationInterception() { const string codeText = @"using System; public class One { private void Foo() { int i1 = 7; int i2 = 9; Assert.AreEqual(i1, i2); } [Template(Interceptor=""Baz"")] private void Bar(int i1, int i2) { Assert.AreEqual(i1, i2); } private void Baz(int i1, int i2) { Assert.That(i1, Is.EqualTo(i2)); } } internal class Template : Attribute { public string Interceptor; } internal static class Is { public static object EqualTo(int s2) { throw new NotImplementedException(); } } internal static class Assert { public static void AreEqual(int s1, int s2) { throw new NotImplementedException(); } public static void That(int s1, object to) { throw new NotImplementedException(); } }"; // The TemplateAttribute on Bar is causing this clone match to fail. ScanResult scanResult = cloneFinder.GetCloneReplacements(codeText); Assert.AreEqual(1, scanResult.Clones.Count, "Foo contains a clone of Bar."); QuickFixInfo clone = scanResult.Clones[0]; Assert.IsTrue(clone.TextForACallToJanga.Contains("Baz"), "The interceptor attribute should have caused a call to Baz, instead of Bar"); }