private static void ConfirmSequenceInvocationIndices(SequenceInvocationIndices sequenceInvocationIndices) { if (sequenceInvocationIndices == null) { throw new ArgumentNullException("sequenceInvocationIndices"); } if (sequenceInvocationIndices.Count == 0) { throw new ArgumentException(SequenceInvocationIndicesEmptyMessage); } }
public static IInvocableSequenceReturn SetupInSequenceShared <T, TReturn>(this Mock <T> mock, Expression <Func <T, TReturn> > setUp, ISequence sequence, ExceptionsOrReturns <TReturn> exceptionsOrReturns, SequenceInvocationIndices sequenceInvocationIndices) where T : class { sequence = sequence ?? throw new ArgumentNullException(nameof(sequence)); return(SetupInSequenceResult(sequence, mock, setUp, exceptionsOrReturns, sequenceInvocationIndices)); }
public static IInvocableSequenceReturn SetupInSequenceCreateShared <T, TReturn>(this Mock <T> mock, Expression <Func <T, TReturn> > setUp, out ISequence sequence, ExceptionsOrReturns <TReturn> exceptionsOrReturns, SequenceInvocationIndices sequenceInvocationIndices, int loops = 1) where T : class { ConfirmLoops(loops); sequence = Sequence.Factory.CreateShared(loops); return(SetupInSequenceResult(sequence, mock, setUp, exceptionsOrReturns, sequenceInvocationIndices)); }
public static IInvocableSequenceReturn SetupInSequenceSingle <T, TReturn>(this Mock <T> mock, Expression <Func <T, TReturn> > setUp, Returns <TReturn> returns, SequenceInvocationIndices sequenceInvocationIndices, int loops = 1) where T : class { ConfirmLoops(loops); return(SetupInSequenceResult(Sequence.Factory.CreateSingle(mock, loops), mock, setUp, returns, sequenceInvocationIndices)); }
private static IInvocableSequenceReturn SetupInSequenceResult <T, TReturn>(ISequence sequence, Mock <T> mock, Expression <Func <T, TReturn> > setUp, ExceptionsOrReturns <TReturn> exceptionsOrReturns, SequenceInvocationIndices sequenceInvocationIndices) where T : class { ConfirmResponsesAndSequenceInvocationIndices(exceptionsOrReturns, "exceptionsOrReturns", sequenceInvocationIndices); var setUpResult = mock.Setup(setUp); var invocable = Invocable.Factory.CreateSequenceReturn <T, TReturn>(setUpResult, mock, sequence, exceptionsOrReturns, sequenceInvocationIndices); sequence.RegisterInvocable(invocable); return(invocable); }
public static ISetup <T, TResult> SetupInSequenceShared <T, TResult>(this Mock <T> mock, Expression <Func <T, TResult> > setUp, ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices) where T : class { sequence = sequence ?? throw new ArgumentNullException(nameof(sequence)); return(SetupInSequenceResult <T, TResult>(sequence, mock, setUp, sequenceInvocationIndices)); }
public static ISetupGetter <T, TProperty> SetupGetInSequenceCreateShared <T, TProperty>(this Mock <T> mock, Expression <Func <T, TProperty> > setupGet, out ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices, int loops = 1) where T : class { ConfirmLoops(loops); sequence = Sequence.Factory.CreateShared(loops); return(SetupGetInSequence(sequence, mock, setupGet, sequenceInvocationIndices)); }
public static IInvocableSequence SetupInSequenceCreateShared <T>(this Mock <T> mock, Expression <Action <T> > setUp, out ISequence sequence, PassOrThrows passOrThrows, SequenceInvocationIndices sequenceInvocationIndices, int loops = 1) where T : class { ConfirmLoops(loops); sequence = Sequence.Factory.CreateShared(loops); return(SetupInSequence <T>(sequence, mock, setUp, passOrThrows, sequenceInvocationIndices)); }
public static ISetupGetter <T, TProperty> SetupGetInSequenceShared <T, TProperty>(this Mock <T> mock, Expression <Func <T, TProperty> > setupGet, ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices) where T : class { sequence = sequence ?? throw new ArgumentNullException(nameof(sequence)); ConfirmSequenceInvocationIndices(sequenceInvocationIndices); return(SetupGetInSequence(sequence, mock, setupGet, sequenceInvocationIndices)); }
private static ISetupGetter <T, TProperty> SetupGetInSequence <T, TProperty>(ISequence sequence, Mock <T> mock, Expression <Func <T, TProperty> > setupGet, SequenceInvocationIndices sequenceInvocationIndices) where T : class { ConfirmSequenceInvocationIndices(sequenceInvocationIndices); var setUpGetter = mock.SetupGet(setupGet); var invocable = Invocable.Factory.CreateGet <T, TProperty>(setUpGetter, mock, sequence, sequenceInvocationIndices); sequence.RegisterInvocable(invocable); return(invocable); }
public static ISetup <T> SetupSetInSequenceCreateShared <T>(this Mock <T> mock, Action <T> setUp, out ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices, int loops = 1) where T : class { ConfirmLoops(loops); sequence = Sequence.Factory.CreateShared(loops); return(SetupSetInSequence(sequence, mock, setUp, sequenceInvocationIndices)); }
public static ISetup <T> SetupSetInSequenceShared <T>(this Mock <T> mock, Action <T> setUp, ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices) where T : class { sequence = sequence ?? throw new ArgumentNullException(nameof(sequence)); return(SetupSetInSequence(sequence, mock, setUp, sequenceInvocationIndices)); }
public static ISetup <T> SetupSetInSequenceSingle <T>(this Mock <T> mock, Action <T> setUp, SequenceInvocationIndices sequenceInvocationIndices, int loops = 1) where T : class { ConfirmLoops(loops); return(SetupSetInSequence(Sequence.Factory.CreateSingle(mock, loops), mock, setUp, sequenceInvocationIndices)); }
public static IInvocableSequence SetupInSequenceShared <T>(this Mock <T> mock, Expression <Action <T> > setUp, ISequence sequence, PassOrThrows passOrThrows, SequenceInvocationIndices sequenceInvocationIndices) where T : class { sequence = sequence ?? throw new ArgumentNullException(nameof(sequence)); return(SetupInSequence <T>(sequence, mock, setUp, passOrThrows, sequenceInvocationIndices)); }
private static void ConfirmResponsesAndSequenceInvocationIndices <TResponse>(IInvocationResponses <TResponse> responses, string responsesParameterName, SequenceInvocationIndices sequenceInvocationIndices) { ConfirmResponses(responses, responsesParameterName); ConfirmSequenceInvocationIndices(sequenceInvocationIndices); if (responses.ConfiguredResponses != sequenceInvocationIndices.Count) { throw new ArgumentException(IncorrectNumberOfConfiguredResponses); } }
private static ISetup <T> SetupInSequence <T>(ISequence sequence, Mock <T> mock, Expression <Action <T> > setUp, SequenceInvocationIndices sequenceInvocationIndices) where T : class { ConfirmSequenceInvocationIndices(sequenceInvocationIndices); var setUpResult = mock.Setup(setUp); var invocable = Invocable.Factory.CreateNoReturn <T>(setUpResult, mock, sequence, sequenceInvocationIndices); sequence.RegisterInvocable(invocable); return(invocable); }
private static IInvocableSequence SetupInSequence <T>(ISequence sequence, Mock <T> mock, Expression <Action <T> > setUp, PassOrThrows passOrThrows, SequenceInvocationIndices sequenceInvocationIndices) where T : class { ConfirmResponsesAndSequenceInvocationIndices(passOrThrows, "passOrThrows", sequenceInvocationIndices); var setUpResult = mock.Setup(setUp); var invocable = Invocable.Factory.CreateSequenceNoReturn <T>(setUpResult, mock, sequence, passOrThrows, sequenceInvocationIndices); sequence.RegisterInvocable(invocable); return(invocable); }