本文整理汇总了C#中Rhino.Mocks.MockRepository.StrictMultiMock方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.StrictMultiMock方法的具体用法?C# MockRepository.StrictMultiMock怎么用?C# MockRepository.StrictMultiMock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rhino.Mocks.MockRepository
的用法示例。
在下文中一共展示了MockRepository.StrictMultiMock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
mockRepository = new MockRepository();
mainTransport = mockRepository.StrictMultiMock<ITransport>();
mainTransport.Replay();
retryingTransport = new RetryingTransport(new SilentLogger(), mainTransport, retryCount, retryDelay);
}
示例2: BeginTest
public void BeginTest()
{
repo = new MockRepository();
channelFactory = repo.StrictMock<ICanCreateChannels<IService>>();
communicationObject = repo.StrictMultiMock<ICommunicationObject>(typeof(IService));
manager = new SingleActionChannelManager<IService>(channelFactory);
}
示例3: ListByDateReturnsListGreaterThanZero
public void ListByDateReturnsListGreaterThanZero()
{
//
var startDate = DateTime.Now.Date;
var endDate = DateTime.Now.Date.AddDays(1);
// Arrange
var repository = new MockRepository();
var mockService = repository.StrictMultiMock<ITaskService>(typeof(ICommunicationObject));
mockService.Expect(f => f.ListByDate(null)) // ignore arguements below
.IgnoreArguments()
.Return(
new TaskListResponse
{
Items = new List<TaskDto>() { new TaskDto() }
});
//mockService.Expect(f => ((ICommunicationObject)f).State).Return(CommunicationState.Opened);
//mockService.Expect(f => ((ICommunicationObject)f).Close()); // only used with invoker, which I'm trying to move to Unity.MVC.WCF instead
repository.ReplayAll();
// Act
var gateway = new TaskGateway(mockService);
var response = gateway.ListByDate(startDate, endDate);
// Assert
Assert.IsTrue(response.Items.Count > 0);
mockService.VerifyAllExpectations();
}
示例4: Accept
public void Accept ()
{
var mockRepository = new MockRepository ();
var visitorMock = mockRepository.StrictMultiMock<ExpressionTreeVisitor> (typeof (ISqlCustomTextGeneratorExpressionVisitor));
var customTextGeneratorExpression = new TestableSqlCustomTextGeneratorExpression (typeof (Cook));
visitorMock
.Expect (mock => ((ISqlCustomTextGeneratorExpressionVisitor)mock).VisitSqlCustomTextGeneratorExpression (customTextGeneratorExpression))
.Return (customTextGeneratorExpression);
visitorMock.Replay();
customTextGeneratorExpression.Accept (visitorMock);
visitorMock.VerifyAllExpectations();
}
示例5: ListByDateReturnsListGreaterThenZero
public void ListByDateReturnsListGreaterThenZero()
{
//
var startDate = DateTime.Now.Date;
var endDate = DateTime.Now.Date.AddDays(1);
// Arrange
var result = new List<Task>() { new Task { } };
var repository = new MockRepository();
var mockService = repository.StrictMultiMock<ITaskBusinessService>();
mockService
.Expect(f => f.ListByDate(startDate, endDate)) // ignore arguements below
.IgnoreArguments()
.Return(result);
// proxy
var stubProxy = MockRepository.GenerateStub<ITaskService>();
stubProxy
.Stub(m => m.ListByDate(Arg<TaskListRequest>.Is.Anything))
.Return(new TaskListResponse()
{
Items = new List<TaskDto>()
{
new TaskDto()
{
TaskId = 1
}
}
});
repository.ReplayAll();
// service
var service = new TaskService(mockService);
// Act
var request = new TaskListRequest
{
StartDate = startDate,
EndDate = endDate
};
var response = service.ListByDate(request);
// Assert
Assert.IsTrue(response.Items.Count > 0);
}
示例6: ListByDateReturnsListGreaterThanZero
public void ListByDateReturnsListGreaterThanZero()
{
//
var startDate = DateTime.Now.Date;
var endDate = DateTime.Now.Date.AddDays(1);
// Arrange
var repository = new MockRepository();
var mockService = repository.StrictMultiMock<ITaskRepository>();
mockService.Expect(f => f.ListByDate(startDate, endDate)) // ignore arguements below
.IgnoreArguments()
.Return(new List<Task> { new Task() });
mockService.Replay();
// Act
var service = new TaskBusinessService(mockService);
var result = service.ListByDate(startDate, endDate);
// Assert
Assert.IsTrue(result.Count > 0);
}
示例7: accept_a_visitor_with_no_interception_and_a_visitable_inner
public void accept_a_visitor_with_no_interception_and_a_visitable_inner()
{
var mocks = new MockRepository();
var visitor = mocks.StrictMock<IBuildPlanVisitor>();
var inner = mocks.StrictMultiMock<IDependencySource>(typeof (IBuildPlanVisitable));
var plan = new BuildPlan(typeof (IGateway), new ObjectInstance(new StubbedGateway()), inner, null);
using (mocks.Ordered())
{
visitor.Instance(plan.PluginType, plan.Instance);
inner.As<IBuildPlanVisitable>().AcceptVisitor(visitor);
}
mocks.ReplayAll();
using (mocks.Playback())
{
plan.AcceptVisitor(visitor);
}
}