c# - How do you create an echoing mock using Moq? -
I'm making a fake for my ITransformer
interface.
public interface iTransformer {string transformation (string input); }
I can make a duplicate that gives a given string based on specific input:
var mock = new mock & lt; ITransformer & gt; (); Counterfeit. Setup (S = & gt; s.Transform ("foo")). Return ("bar");
What I would like to do, to make a duplicate with a conversion ()
method, copy whatever gets passed to it. How would I go about doing this? Is this also possible?
I realized that the way my question is competing and usually the mock is to work, because I am not specifying a specific hope.
I also know that I can easily make my own class to do this, but I had the hope of using normal situations without defining the new class every time.
Whatever was supplied to this method should be resized back.
Comments
Post a Comment