Пример #1
0
        public StubSetup <TInterface, TNextProperty> Get <TNextProperty>(
            Expression <Func <TInterface, TNextProperty> > expression)
        {
            ISetupGetter <TInterface, TNextProperty> getter = _mock.SetupGet(expression);

            return(new StubSetup <TInterface, TNextProperty>(_mock, getter));
        }
Пример #2
0
 // commenting out this method allowed the project to compile without the reference to EF
 public static IReturnsResult <T> ReturnsSet <T, TProperty, TEntity>(this ISetupGetter <T, TProperty> setupGetter, params TEntity[] data)
     where T : class
     where TProperty : IDbSet <TEntity>
     where TEntity : class, new()
 {
     return(setupGetter.Returns((TProperty)DbSet(data)));
 }
Пример #3
0
        public StubSetup <TInterface, TProperty> Get <TProperty>(
            Expression <Func <TInterface, TProperty> > expression)
        {
            _mock = _mock ?? new Mock <TInterface>();
            ISetupGetter <TInterface, TProperty> getter = _mock.SetupGet(expression);

            return(new StubSetup <TInterface, TProperty>(_mock, getter));
        }
Пример #4
0
 public MoqSetupGetterWrapper(
     ISetupGetter <TMock, TProperty> setupGetter,
     LambdaExpression expression,
     IVerifiedMock testeroidsMock)
 {
     this.Expression         = expression;
     this.TesteroidsMock     = testeroidsMock;
     this.wrappedSetupGetter = setupGetter;
 }
Пример #5
0
        public static void ReturnsInOrder <T, TResult>(this ISetupGetter <T, TResult> setup, params object[] results) where T : class
        {
            var queue = new Queue(results);

            setup.Returns(() =>
            {
                var result = queue.Dequeue();
                if (result is Exception)
                {
                    throw result as Exception;
                }
                return((TResult)result);
            });
        }
 public static ISetupGetter <T, TProperty> InSequence <T, TProperty>(this ISetupGetter <T, TProperty> setup) where T : class
 {
     return(InSequence(setup, Times.Once()));
 }
Пример #7
0
 protected override InvocableGet <IToMock, int> CreateInvocable(ISetupGetter <IToMock, int> wrapped, ISequence sequence, IVerifiableWrapper verifiableWrapper, ICallbackWrapper callbackWrapper)
 {
     return(new InvocableGet <IToMock, int>(wrapped, null, sequence, 0, verifiableWrapper, callbackWrapper));
 }
Пример #8
0
 protected override InvocableGet <IToMock, int> CreateInvocable(ISetupGetter <IToMock, int> wrapped)
 {
     return(new InvocableGet <IToMock, int>(wrapped, null, null, 0, null, null));
 }
Пример #9
0
 public IInvocableGet <T, TProperty> CreateGet <T, TProperty>(ISetupGetter <T, TProperty> setUpGetter, Mock <T> mock, ISequence sequence, int consecutiveInvocations) where T : class
 {
     return(new InvocableGet <T, TProperty>(setUpGetter, mock, sequence, consecutiveInvocations));
 }
Пример #10
0
 internal StubSetup(Mock <TInterface> mock, ISetupGetter <TInterface, TProperty> getter)
 {
     _getter = getter;
     _mock   = mock;
 }
Пример #11
0
 internal FluentPropertyGet(FluentMock<T> mock, ISetupGetter<T, TProperty> setup, Expression<Func<T, TProperty>> expression)
 {
     m_mock = mock;
     m_setup = setup;
     m_expression = expression;
 }
Пример #12
0
 public IInvocableGet <T, TProperty> CreateGet <T, TProperty>(ISetupGetter <T, TProperty> setUpGetter, Mock <T> mock, ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices) where T : class
 {
     return(new InvocableGet <T, TProperty>(setUpGetter, mock, sequence, sequenceInvocationIndices));
 }
Пример #13
0
 protected override InvocableBase <ISetupGetter <IToMock, int> > CreateInvocableSequenceInvocationIndices(ISetupGetter <IToMock, int> wrapped, Mock <IToMock> mock, ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices, IVerifiableWrapper verifiableWrapper, ICallbackWrapper callbackWrapper)
 {
     return(new InvocableGet <IToMock, int>(wrapped, mock, sequence, sequenceInvocationIndices, verifiableWrapper, callbackWrapper));
 }
Пример #14
0
 public static ISetupGetter <T, TProperty> InSequence <T, TProperty>(this ISetupGetter <T, TProperty> setup, Times expectedCalls) where T : class
 {
     AddStep(setup, expectedCalls);
     return(setup);
 }
Пример #15
0
 internal static void ReturnsAsync <TMock, TResult>(this ISetupGetter <TMock, Task <TResult> > mock, TResult result) where TMock : class
 {
     mock.Returns(Task.FromResult(result));
 }
Пример #16
0
 public InvocableGet(ISetupGetter <TMock, TProperty> wrapped, Mock mock, ISequence sequence, int consecutiveInvocations, IVerifiableWrapper verifiableWrapper = null, ICallbackWrapper callbackWrapper = null) : base(wrapped, mock, sequence, consecutiveInvocations, verifiableWrapper, callbackWrapper)
 {
 }
Пример #17
0
 protected sealed override void RegisterForCallback(ISetupGetter <TMock, TProperty> wrapped, Action invokedAction)
 {
     wrapped.Callback(invokedAction);
 }
Пример #18
0
        internal static void AddStep <T, TResult>(ISetupGetter <T, TResult> setup, Times expectedCalls) where T : class
        {
            var step = Sequence.Step(setup, expectedCalls);

            setup.Callback(() => Sequence.Record(step));
        }
Пример #19
0
 internal override IInvocableInternal <ISetupGetter <IToMock, int> > CreateInvocable(ISetupGetter <IToMock, int> wrapped, Mock <IToMock> mock, ISequence sequence, SequenceInvocationIndices sequenceInvocationIndices)
 {
     return(invocableFactory.CreateGet(wrapped, mock, sequence, sequenceInvocationIndices));
 }