public void GetModifiedAssemblies() { AssemblyTracker tracker = new AssemblyTracker (new[] { _assemblyDefinition1, _assemblyDefinition2 }, new TypeDefinitionCache ()); tracker.MarkModified (_assemblyDefinition1); var result = tracker.GetModifiedAssemblies(); Assert.That (result, Is.EquivalentTo (new[] { _assemblyDefinition1 })); }
public void GetAssemblyByReference_NoMatchFound() { var name = AssemblyNameReferenceObjectMother.CreateAssemblyNameReferenceWithCulture ("TestCase1", "de"); AssemblyDefinition assembly = AssemblyDefinitionObjectMother.CreateAssemblyDefinition ("TestCase1"); AssemblyDefinition assembly2 = AssemblyDefinitionObjectMother.CreateAssemblyDefinition ("TestCase2"); AssemblyTracker tracker = new AssemblyTracker (new[] { assembly, assembly2 }, new TypeDefinitionCache ()); var result = tracker.GetAssembliesByReference (name); Assert.That (result, Is.Empty); }
public void GetAssemblyByReference() { var name = AssemblyNameReferenceObjectMother.CreateAssemblyNameReference("TestCase1"); AssemblyDefinition assembly = AssemblyDefinitionObjectMother.CreateAssemblyDefinition ("TestCase1"); AssemblyDefinition assembly2 = AssemblyDefinitionObjectMother.CreateAssemblyDefinition ("TestCase2"); AssemblyTracker tracker = new AssemblyTracker (new[] { assembly, assembly2 }, new TypeDefinitionCache ()); var result = tracker.GetAssembliesByReference (name); Assert.That (result, Is.EqualTo (new [] {assembly})); }
public void GetReverseReferences_MultiModuleAssembly() { ModuleDefinition module = ModuleDefinition.CreateModule ("Module1", ModuleKind.NetModule); module.AssemblyReferences.Add (_assemblyDefinition2.Name); _assemblyDefinition1.Modules.Add (module); AssemblyTracker tracker = new AssemblyTracker (new[] { _assemblyDefinition1, _assemblyDefinition2 }, new TypeDefinitionCache ()); var reverseReferences = tracker.GetReverseReferences (_assemblyDefinition2); Assert.That (reverseReferences, Is.EquivalentTo (new[] { _assemblyDefinition1 })); }
public void GetReverseReferences() { _assemblyDefinition1.MainModule.AssemblyReferences.Add (_assemblyDefinition2.Name); AssemblyTracker tracker = new AssemblyTracker (new[] { _assemblyDefinition1, _assemblyDefinition2 }, new TypeDefinitionCache ()); var reverseReferences = tracker.GetReverseReferences (_assemblyDefinition2); Assert.That (reverseReferences, Is.EquivalentTo (new [] {_assemblyDefinition1})); }
public void MarkUnodified_NotTracked() { AssemblyTracker tracker = new AssemblyTracker (new[] { _assemblyDefinition1 }, new TypeDefinitionCache ()); Assert.Throws<ArgumentException> (() => tracker.MarkUnmodified (_assemblyDefinition2)); }
public void MarkUnmodified() { AssemblyTracker tracker = new AssemblyTracker (new[] { _assemblyDefinition1 }, new TypeDefinitionCache ()); tracker.MarkModified (_assemblyDefinition1); Assert.That (tracker.IsModified (_assemblyDefinition1), Is.True); tracker.MarkUnmodified (_assemblyDefinition1); Assert.That (tracker.IsModified (_assemblyDefinition1), Is.False); }
public void Initialization_ReferenceNotTracked() { _assemblyDefinition1.MainModule.AssemblyReferences.Add (_assemblyDefinition2.Name); AssemblyTracker tracker = new AssemblyTracker (new[] { _assemblyDefinition1 }, new TypeDefinitionCache ()); Assert.That (tracker.GetAssemblies (), Is.EquivalentTo (new[] { _assemblyDefinition1 })); }
public void Initialization() { AssemblyTracker tracker = new AssemblyTracker(new [] { _assemblyDefinition1, _assemblyDefinition2}, new TypeDefinitionCache()); Assert.That (tracker.GetAssemblies(), Is.EquivalentTo (new[] { _assemblyDefinition1, _assemblyDefinition2 })); }
public void GetReverseReferences_NotTracked() { AssemblyTracker tracker = new AssemblyTracker (new AssemblyDefinition[0], new TypeDefinitionCache ()); Assert.Throws<ArgumentException> (() => tracker.GetReverseReferences (_assemblyDefinition1)); }
private IAssemblyTracker CreateTracker(params AssemblyDefinition[] modifiedAssemblies) { // Should AssemblyTracker get external dependencies (or become otherwise more complex), consider using a stub instead of the real tracker. var tracker = new AssemblyTracker (new[] { _assemblyDefinition1, _assemblyDefinition2 }, new TypeDefinitionCache ()); foreach (var modifiedAssembly in modifiedAssemblies) tracker.MarkModified (modifiedAssembly); return tracker; }