Bonne question. Je voudrais injecter des talons ou des faux sur les méthodes mises en œuvre pour mettre en place le test. Donc si j'implémente l'interface IRFormScript comme ci-dessous. Je pourrais utiliser un stub qui implémente l'interface IRForm pour configurer les attentes sur l'objet de formulaire qui est injecté dans mes méthodes. Certains de ces arguments ne sont que des chaînes, donc c'est facile. Vous devrez également remplacer toutes les autres interfaces de Pivotal afin de tester votre fonctionnalité sans réellement toucher le système réel (IRSystem7, DataAccess, etc.) J'espère que cela vous aidera! Brandon Joyce
public class TDD : Pivotal.Interop.RDALib.IRFormScript
{
public object AddFormData(Pivotal.Interop.RDALib.IRForm pForm, object Recordsets, ref object ParameterList)
{
throw new NotImplementedException();
}
public void DeleteFormData(Pivotal.Interop.RDALib.IRForm pForm, object RecordId, ref object ParameterList)
{
throw new NotImplementedException();
}
public void Execute(Pivotal.Interop.RDALib.IRForm pForm, string MethodName, ref object ParameterList)
{
throw new NotImplementedException();
}
public object LoadFormData(Pivotal.Interop.RDALib.IRForm pForm, object RecordId, ref object ParameterList)
{
throw new NotImplementedException();
}
public object NewFormData(Pivotal.Interop.RDALib.IRForm pForm, ref object ParameterList)
{
throw new NotImplementedException();
}
public void NewSecondaryData(Pivotal.Interop.RDALib.IRForm pForm, object SecondaryName, ref object ParameterList, ref Pivotal.Interop.ADODBLib.Recordset Recordset)
{
throw new NotImplementedException();
}
public void SaveFormData(Pivotal.Interop.RDALib.IRForm pForm, object Recordsets, ref object ParameterList)
{
throw new NotImplementedException();
}
public void SetSystem(Pivotal.Interop.RDALib.RSystem pSystem)
{
throw new NotImplementedException();
}
}
Salut Brandom, Merci beaucoup. J'ai des problèmes pour accepter votre réponse (voir http://stackoverflow.com/questions/637822/is-there-a-bug-keeps-me-from-accepting-an-answer-from-an-expired-bounty) De toute façon je vais devoir essayer. Mais je sens que je manque quelque chose de la grande image et je suis nouveau pour les tests. – borjab
Se moquer de tout ça peut sembler être un travail, mais c'est assez facile avec un cadre moqueur comme Rhino Mocks. Il s'agit vraiment de pouvoir tester cette chose de manière isolée. Cela en vaut la peine. Bonne chance! –