当前位置: 首页>>代码示例>>C#>>正文


C# MockRepository.StrictMultiMock方法代码示例

本文整理汇总了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);
 }
开发者ID:palpha,项目名称:EasyGelf,代码行数:7,代码来源:RetryTransportTests.cs

示例2: BeginTest

 public void BeginTest()
 {
     repo = new MockRepository();
     channelFactory = repo.StrictMock<ICanCreateChannels<IService>>();
     communicationObject = repo.StrictMultiMock<ICommunicationObject>(typeof(IService));
     manager = new SingleActionChannelManager<IService>(channelFactory);
 }
开发者ID:sergiomcalzada,项目名称:SpringWCFChannelManager,代码行数:7,代码来源:SingleActionChannelManagerTests.cs

示例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();
        }
开发者ID:benpowell,项目名称:PowellSOA,代码行数:28,代码来源:TaskGatewayTest.cs

示例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();
    }
开发者ID:re-motion,项目名称:Relinq-SqlBackend,代码行数:16,代码来源:SqlCustomTextGeneratorExpressionBaseTest.cs

示例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);
        }
开发者ID:benpowell,项目名称:PowellSOA,代码行数:46,代码来源:TaskServiceTest.cs

示例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);
        }
开发者ID:benpowell,项目名称:PowellSOA,代码行数:21,代码来源:TaskBusinessServiceTest.cs

示例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);
            }
        }
开发者ID:goraw,项目名称:structuremap,代码行数:22,代码来源:BuildPlan_AcceptVisitor_Behavior.cs


注:本文中的Rhino.Mocks.MockRepository.StrictMultiMock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。