public void Unify_NonUnifiableNames_False(string n1, string n2, Refactorization r) { IEnumerable <Substitution> bindings = new List <Substitution>(); var isUnifiable = true; if (r == Refactorization.Current) { var name1 = Name.BuildName(n1); var name2 = Name.BuildName(n2); for (int i = 0; i < unifierReps; i++) { isUnifiable = Unifier.Unify(name1, name2, out bindings); } } else if (r == Refactorization.New) { var name1 = new SimpleName(n1); var name2 = new SimpleName(n2); for (int i = 0; i < unifierReps; i++) { isUnifiable = SimpleUnifier.Unify(name1, name2, out bindings); } } Assert.That(!isUnifiable); Assert.That(bindings == null); }
public void Unify_UnifiableNames_True(string n1, string n2, string[] result, Refactorization r) { var expectedBindings = result.Select(s => new Substitution(s)); IEnumerable <Substitution> bindings = null; var isUnifiable = false; if (r == Refactorization.Current) { var name1 = Name.BuildName(n1); var name2 = Name.BuildName(n2); for (int i = 0; i < unifierReps; i++) { isUnifiable = Unifier.Unify(name1, name2, out bindings); } } else if (r == Refactorization.New) { var name1 = new SimpleName(n1); var name2 = new SimpleName(n2); for (int i = 0; i < unifierReps; i++) { isUnifiable = SimpleUnifier.Unify(name1, name2, out bindings); } } Assert.That(isUnifiable); if (result.Any()) { Assert.That(bindings, Is.EquivalentTo(expectedBindings)); } else { Assert.That(bindings.Count() == 0); } }