public void Classe_complexe_retourne_prediction_si_a_constructeur() { classId = registry.AddCustomClass("custom"); registry.GetClassById(classId).AddConstructor(); var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>()); Assert.AreEqual(2, visitor.GetPredictions().Count); }
public void Classe_primitive_retourne_prediction_avec_OperandeVariable_new() { var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>()); var prediction = visitor.GetPredictions()[0]; Assert.IsTrue(prediction.Expression is OperandeVariable); Assert.IsTrue(((OperandeVariable)prediction.Expression).IsNew); }
public void Retourne_prediction_avec_une_variable_si_methode_d_instance() { registry.GetClassById(classId).AddMethod("method"); var visitor = new AutocompleteVisitor( ref registry, new List<OperandeVariable> { new OperandeVariable(classId, "var1") }); Assert.AreEqual(2, visitor.GetPredictions().Count); }
public void Doit_pas_retourner_de_prediction_constante() { var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>()); var tmp = visitor.Visit(newVar); Assert.AreEqual(0, tmp .Where(prediction => prediction.Expression is OperandeConstante) .Count()); }
public void Doit_retourner_prediction_methode_d_instance() { registry.GetClassById(classId).AddMethod("method"); var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>()); var tmp = visitor.Visit(newVar); Assert.AreEqual(1, tmp .Where(prediction => prediction.Expression is MethodExpression) .Count()); }
public void Doit_pas_retourner_de_prediction_variable() { registry.GetClassById(classId).AddMethod("staticMethod", null, null, true); var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>() { newVar}); var tmp = visitor.Visit(newVar); Assert.AreEqual(0, tmp .Where(prediction => prediction.Expression is OperandeVariable) .Count()); }
public void Retourne_prediction_sans_variable_si_aucune_methode_d_instance() { registry.GetClassById(classId).AddMethod("staticMethod", null, null, true); var visitor = new AutocompleteVisitor( ref registry, new List<OperandeVariable>{ new OperandeVariable(classId, "var1")}); Assert.AreEqual(1, visitor.GetPredictions().Count); }
public void Classe_primitive_retourne_prediction() { var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>()); Assert.AreEqual(1, visitor.GetPredictions().Count); }
public void Doit_retourner_prediction_operateur_avec_seulement_egal() { var visitor = new AutocompleteVisitor(ref registry, new List<OperandeVariable>()); var tmp = visitor.Visit(newVar); Assert.AreEqual(1, tmp .Where(prediction => prediction.Expression is OperatorExpression) .Count()); Assert.IsTrue(tmp .Where(prediction => prediction.Expression is OperatorExpression) .Select(prediction => prediction.Expression) .Cast<OperatorExpression>() .FirstOrDefault() .Operator == OPERATOR.EQUAL); }