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)); }
// 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))); }
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)); }
public MoqSetupGetterWrapper( ISetupGetter <TMock, TProperty> setupGetter, LambdaExpression expression, IVerifiedMock testeroidsMock) { this.Expression = expression; this.TesteroidsMock = testeroidsMock; this.wrappedSetupGetter = setupGetter; }
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())); }
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)); }
protected override InvocableGet <IToMock, int> CreateInvocable(ISetupGetter <IToMock, int> wrapped) { return(new InvocableGet <IToMock, int>(wrapped, null, null, 0, null, null)); }
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)); }
internal StubSetup(Mock <TInterface> mock, ISetupGetter <TInterface, TProperty> getter) { _getter = getter; _mock = mock; }
internal FluentPropertyGet(FluentMock<T> mock, ISetupGetter<T, TProperty> setup, Expression<Func<T, TProperty>> expression) { m_mock = mock; m_setup = setup; m_expression = expression; }
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)); }
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)); }
public static ISetupGetter <T, TProperty> InSequence <T, TProperty>(this ISetupGetter <T, TProperty> setup, Times expectedCalls) where T : class { AddStep(setup, expectedCalls); return(setup); }
internal static void ReturnsAsync <TMock, TResult>(this ISetupGetter <TMock, Task <TResult> > mock, TResult result) where TMock : class { mock.Returns(Task.FromResult(result)); }
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) { }
protected sealed override void RegisterForCallback(ISetupGetter <TMock, TProperty> wrapped, Action invokedAction) { wrapped.Callback(invokedAction); }
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)); }
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)); }