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


C# RhinoAutoMocker.Inject方法代码示例

本文整理汇总了C#中RhinoAutoMocker.Inject方法的典型用法代码示例。如果您正苦于以下问题:C# RhinoAutoMocker.Inject方法的具体用法?C# RhinoAutoMocker.Inject怎么用?C# RhinoAutoMocker.Inject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RhinoAutoMocker的用法示例。


在下文中一共展示了RhinoAutoMocker.Inject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MatchesUrlAndRepositoryPath_should_be_false_if_no_match_for_tfs_repository_path

        public void MatchesUrlAndRepositoryPath_should_be_false_if_no_match_for_tfs_repository_path()
        {
            var mocker = new RhinoAutoMocker<GitTfsRemote>();
            mocker.Inject<TextWriter>(new StringWriter());
            var helper = MockRepository.GenerateStub<ITfsHelper>();
            helper.Url = "test";
            helper.LegacyUrls = new string[0];
            mocker.Inject(helper);
            mocker.ClassUnderTest.TfsRepositoryPath = "$/Test";

            bool matches = mocker.ClassUnderTest.MatchesUrlAndRepositoryPath("test", "$/shouldnotmatch");

            Assert.Equal(false, matches);
        }
开发者ID:daniellee,项目名称:git-tfs,代码行数:14,代码来源:GitTfsRemoteTests.cs

示例2: MatchesUrlAndRepositoryPath_should_be_case_insensitive_for_tfs_url

        public void MatchesUrlAndRepositoryPath_should_be_case_insensitive_for_tfs_url()
        {
            var mocker = new RhinoAutoMocker<GitTfsRemote>();
            mocker.Inject<TextWriter>(new StringWriter());
            var helper = MockRepository.GenerateStub<ITfsHelper>();
            helper.Url = "http://testvcs:8080/tfs/test";
            helper.LegacyUrls = new string[0];
            mocker.Inject(helper);
            mocker.ClassUnderTest.TfsRepositoryPath = "test";

            bool matches = mocker.ClassUnderTest.MatchesUrlAndRepositoryPath("http://testvcs:8080/tfs/Test", "test");

            Assert.Equal(true, matches);
        }
开发者ID:daniellee,项目名称:git-tfs,代码行数:14,代码来源:GitTfsRemoteTests.cs

示例3: Setup

 public void Setup()
 {
     mocks = new RhinoAutoMocker<Shelve>();
     mocks.Inject<TextWriter>(new StringWriter());
     mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
     mocks.MockObjectFactory();
 }
开发者ID:chrisortman,项目名称:git-tfs,代码行数:7,代码来源:ShelveTest.cs

示例4: BuildRemote

 private GitTfsRemote BuildRemote(string repository, string url = "", string[] legacyUrls = null)
 {
     if (legacyUrls == null)
         legacyUrls = new string[0];
     var info = new RemoteInfo
     {
         Url = url,
         Repository = repository,
         Aliases = legacyUrls,
     };
     var mocks = new RhinoAutoMocker<GitTfsRemote>();
     mocks.Inject<TextWriter>(new StringWriter());
     mocks.Inject<RemoteInfo>(info);
     mocks.Inject<ITfsHelper>(MockRepository.GenerateStub<ITfsHelper>()); // GitTfsRemote backs the TfsUrl with this.
     return mocks.ClassUnderTest;
 }
开发者ID:runt18,项目名称:git-tfs,代码行数:16,代码来源:GitTfsRemoteTests.cs

示例5: SetUp

        public virtual void SetUp()
        {
            AutomapperConfiguration.Configure();
            _autoMocker = new RhinoAutoMocker<HomeController>();

            _autoMocker.Inject<IMapperFactory>(new MapperFactory(new Container(c =>
            {
                c.AddRegistry<TestRegistry>();
            })));
        }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:10,代码来源:HomeControllerTestBase.cs

示例6: SetUp

        public virtual void SetUp()
        {
            rollbarclient = MockRepository.GenerateStub<IRollbarClient>();
            autoMocker = new RhinoAutoMocker<BoardGameGeekBatchUpdateJobService>();
            autoMocker.Inject(typeof(IRollbarClient), rollbarclient);

            autoMocker.Get<IDataContext>()
                .Expect(mock => mock.GetQueryable<GameDefinition>())
                .Return(OrphanGames.AsQueryable());
        }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:10,代码来源:LinkOrphanGamesJobTests.cs

示例7: SetUp

        public void SetUp()
        {
            autoMocker = new RhinoAutoMocker<UserSessionsController>();

            var dataProtector = MockRepository.GenerateMock<IDataProtector>();
            userStoreMock = MockRepository.GenerateMock<IUserStore<ApplicationUser>>();
            var dataProtectionProvider = MockRepository.GenerateMock<IDataProtectionProvider>();
            dataProtectionProvider.Expect(mock => mock.Create("ASP.N‌​ET Identity")).Return(dataProtector);
            var applicationUserManager = MockRepository.GeneratePartialMock<ApplicationUserManager>(userStoreMock, dataProtectionProvider);
            autoMocker.Inject(applicationUserManager);

            var controllerContextMock = MockRepository.GeneratePartialMock<HttpControllerContext>();
            var actionDescriptorMock = MockRepository.GenerateMock<HttpActionDescriptor>();
            autoMocker.ClassUnderTest.ActionContext = new HttpActionContext(controllerContextMock, actionDescriptorMock);
            autoMocker.ClassUnderTest.Request = new HttpRequestMessage();
            autoMocker.ClassUnderTest.Request.SetConfiguration(new HttpConfiguration());

            AutomapperConfiguration.Configure();
        }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:19,代码来源:UserSessionsControllerTests.cs

示例8: TestSetUp

		public virtual void TestSetUp()
		{
            autoMocker = new RhinoAutoMocker<PlayedGameController>();

            autoMocker.Inject<IMapperFactory>(new MapperFactory(new Container(c =>
            {
                c.AddRegistry<TestRegistry>();
            })));

            currentUser = new ApplicationUser()
			{
				CurrentGamingGroupId = 1
			};
			gameDefinitionSummaries = new List<GameDefinitionSummary>();
            autoMocker.Get<IGameDefinitionRetriever>().Expect(mock => mock.GetAllGameDefinitions(currentUser.CurrentGamingGroupId))
				.Repeat.Once()
				.Return(gameDefinitionSummaries);

		    autoMocker.ClassUnderTest.Url = MockRepository.GenerateMock<UrlHelper>();
		}
开发者ID:NemeStats,项目名称:NemeStats,代码行数:20,代码来源:PlayedGameControllerTestBase.cs

示例9: Establish_context

        protected override void Establish_context()
        {
            base.Establish_context();

            _product1 = new Product { ProductId = 1, Name = "one", Price = 1.11m };
            _product2 = new Product { ProductId = 2, Name = "two", Price = 2.22m };

            _mocker = new RhinoAutoMocker<OrderController>();

            // stub the Session
            _session = new FakeHttpSession();
            _mocker.Inject<IHttpSession>(_session);

            // available products
            _mocker.Get<IGetProductService>().Stub(s => s.GetAvailableProducts())
                .Return(new[]
                            {
                                _product1,
                                _product2,
                                new Product {ProductId = 3, Name = "three", Price = 3.33m}
                            });
        }
开发者ID:JonKruger,项目名称:MvcStarterProject,代码行数:22,代码来源:OrderControllerTests.cs

示例10: Setup

 public void Setup()
 {
     _mocks = new RhinoAutoMocker<GitTfsCommandRunner>(MockMode.AAA);
     _mocks.Inject<TextWriter>(new StringWriter());
 }
开发者ID:noamkfir,项目名称:git-tfs,代码行数:5,代码来源:GitTfsCommandRunnerTests.cs

示例11: ShelveTest

 public ShelveTest()
 {
     mocks = new RhinoAutoMocker<Shelve>();
     mocks.Inject<TextWriter>(new StringWriter());
     mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
 }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:6,代码来源:ShelveTest.cs

示例12: Setup

 public void Setup()
 {
     mocks = new RhinoAutoMocker<Pull>();
     mocks.Inject<TextWriter>(new StringWriter());
 }
开发者ID:adamchester,项目名称:git-tfs,代码行数:5,代码来源:PullTest.cs

示例13: Setup

 public void Setup()
 {
     outputWriter = new StringWriter();
     mocks = new RhinoAutoMocker<Init>(MockMode.AAA);
     mocks.Inject<TextWriter>(outputWriter);
 }
开发者ID:XinChenBug,项目名称:git-tfs,代码行数:6,代码来源:InitTest.cs

示例14: SetUp

 public void SetUp()
 {
     autoMocker = new RhinoAutoMocker<NemeStatsDataContext>();
     autoMocker.Inject(MockRepository.GenerateMock<NemeStatsDbContext>());
 }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:5,代码来源:CommitAllChangesTests.cs

示例15: InitBranchTest

 public InitBranchTest()
 {
     mocks = new RhinoAutoMocker<InitBranch>();
     mocks.Inject<TextWriter>(new StringWriter());
     mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
 }
开发者ID:nobitagamer,项目名称:git-tfs,代码行数:6,代码来源:InitBranchTest.cs


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