I've created an extension method to call moq (see below) per
example The use case is:
mock.setup.CallbackSequence (new list {h, e, l, l, o}) Hello in my SUT and expect the characters in sequence. The problem is:
Fake. Set-up. Callback Sevens (New list {H, E, L, L, O, X}) Where I pass Hello will pass this though the dynamic claim nature (X is never sent, but we never know) should fail due to it. Its the only way I can think of fixing it. Fake. Verify (setupmethod, Times.Exactly (list.Count)) However, callback setup and validation is done in two different places, so to realize this fault Expansion method will come to the consumer. I would not want to put them on, because it is despite failing ... Suggestions?
Public static icelac feedback callback white < TMockType, T1, T2 & gt; (This ISetup & lt; TMockType & gt; mocketup, iiLIT & lt; t1 & gt; indexed list) where TMockType: class {// Refactor: If it does not reach the end, then fails only And / or too long index index = 0; Return Macketup Callback ((T1T1, T2T2) => gt; {if (index = gt; indexed list.account) is to emphasize. (False, "indexed list uses indexes out of bounds It is calculated that "the sequential list. + Calculation +"; is the index "+ index +", the value is being checked "+ t1"); var current itam inscience = indexed index [index]; (T1, I. Aqualto (current Eatime Insuienseen), String.format ("In case status Index, index);} edit The only thing that I can think that it can work to return the custom object that the customer has to call at the end:
var sequence method ... callback white (); // Do Stuff Sequence Verifier.VerifySequence (); It is still not optimal for me because it gives the assumption that until VerifySequence is not said it will not be verified But it will only execute the case of side .... unless I do not insist on callback, but just ??????? emphasis on track and end It can be work, idea ????
After talking with some colleagues, we come up with a double vision that will leave the implementer . Return a sequence approach , which is its VerifySequenceCalls Option 2 Option 1 / P>
I can use a sequence verification in my 2 options. Again, it depends on the consumer how they want to see their code.
Public stable MockSequenceVerifier & lt; T1 & gt; Callback in order form & lt; TMockType, T1, T2 & gt; (This ISetup & lt; TMockType & gt; Fake setup, ILITT & lt; T1 & quot; sequential list) where TMockType: class {var mockSequenceVerifier = new MockSequenceVerifier & lt; T1 & gt; (SequencedList); Mock Setup Callback (T1T1, T2T2) => Fake sewenvener spoilers updated update (T1)); Return mask vector; } Public static zero VerifySequenceAfterActionPerformed & lt; TMockType, T1, T2 & gt; (This ISetup & lt; TMockType & gt; Counterfeit Setup, ILITT & lt; T1> Indexed List, Action Actionoffs Form), where TMockType: class {var validator = callback in order of suvens & lt; TMockType, T1, T2 & gt; (Fake set, indexed list); ActionToPerform (); Verifier.VerifySequence (); } Public Sector MockSequenceVerifier & lt; T & gt; {Private IList & lt; T & gt; Indexfreeforestforest {receive; Set; } Private IList & lt; T & gt; Real hyperactivity {get; Set; } Public mask vector (IList & lt; T & gt; Sequence) Actual hyperactivity = new list & lt; T & gt; (); } Public Zero VerifySequence () {ActualSequence.IsEqualTo (SequenceToVerifyAgainst); } Public Zero UpdateSequence (t items) {actual empowerment. Add (item); }}
No comments:
Post a Comment