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


C# RhinoAutoMocker类代码示例

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


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

示例1: SetUpBase

        public void SetUpBase()
        {
            _autoMocker = new RhinoAutoMocker<PlayerSaver>();

            _currentUser = new ApplicationUser
            {
                CurrentGamingGroupId = 12
            };

            _playerThatAlreadyExists = new Player
            {
                Name = "the new player name"
            };
            _idOfPlayerThatAlreadyExists = 9;
            _players = new List<Player>
            {
                new Player
                {
                    Id = _idOfPlayerThatAlreadyExists,
                    Name = this._playerThatAlreadyExists.Name,
                    GamingGroupId = _currentUser.CurrentGamingGroupId
                },
                new Player
                {
                    Id = 2
                }
            };
            _autoMocker.Get<IDataContext>().Expect(mock => mock.GetQueryable<Player>())
                .Repeat.Once()
                .Return(_players.AsQueryable());
        }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:31,代码来源:PlayerSaverTestBase.cs

示例2: SetUp

        public void SetUp()
        {
            var container = new RhinoAutoMocker<ApplicationController>();
            var application = container.Get<IApplication>();
            var hotKeySpecification = container.Get<IHotKeySpecification>();
            var reportPesenter = container.Get<IReportPresenter>();
            var keyboard = container.Get<IKeyboard>();

            _presentationController = container.Get<IPresentationController>();
            _keyboardEventArgs = new KeyboardEventArgs{Handled = false};

            hotKeySpecification
                .Stub(spec => spec.IsSatisfiedBy(Arg<IKeyboard>.Is.Anything))
                .Return(true);

            keyboard
                .Stub(x => x.AltPressed)
                .Return(true);

            keyboard
                .Stub(x => x.CtrlPressed)
                .Return(true);

            keyboard
                .Stub(x => x.ShiftPressed)
                .Return(true);

            keyboard
                .Stub(x => x.KeyPressed)
                .Return(VirtualKeyCode.VK_T);

            var systemUnderTest = container.ClassUnderTest;

            keyboard.Raise(x=>x.KeyDown += null, this, _keyboardEventArgs);
        }
开发者ID:archnaut,项目名称:sandbox,代码行数:35,代码来源:ApplicationControllerFixtures.cs

示例3: Establish_Context

        public void Establish_Context()
        {
            _mocks = new RhinoAutoMocker<TodoListRepository>();
            _repository = _mocks.ClassUnderTest;

            _repository.Add(new TodoListItem());
        }
开发者ID:dineshkummarc,项目名称:Session--6--DI---IoC-Containers,代码行数:7,代码来源:When_I_Add_A_TodoListItem.cs

示例4: TestSetUp

        public void TestSetUp()
        {
            autoMocker = new RhinoAutoMocker<PlayedGameSaver>();
            autoMocker.PartialMockTheClassUnderTest();

            currentUser = new ApplicationUser
            {
                Id = "user id",
                CurrentGamingGroupId = GAMING_GROUP_ID,
                AnonymousClientId = "anonymous client id"
            };
            gameDefinition = new GameDefinition
            {
                Name = "game definition name",
                GamingGroupId = GAMING_GROUP_ID,
                Id = 9598
            };

            autoMocker.Get<ISecuredEntityValidator>().Expect(mock => mock.RetrieveAndValidateAccess<GameDefinition>(Arg<int>.Is.Anything, Arg<ApplicationUser>.Is.Anything)).Return(gameDefinition);

            existingPlayerWithMatchingGamingGroup = new Player
            {
                Id = 1,
                GamingGroupId = GAMING_GROUP_ID
            };
            autoMocker.Get<IDataContext>().Expect(mock => mock.FindById<Player>(Arg<int>.Is.Anything)).Return(existingPlayerWithMatchingGamingGroup);
        }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:27,代码来源:PlayedGameSaverTestBase.cs

示例5: SetupFixtureContext

        protected override void SetupFixtureContext()
        {
            _mocks = new RhinoAutoMocker<VideosController>();
            Controller = _mocks.ClassUnderTest;

            _video = new Video() {Id = Guid.NewGuid()};
        }
开发者ID:rauhryan,项目名称:sweetvids,代码行数:7,代码来源:VideoActionGetTester.cs

示例6: Given_device_when_RegisterNewDevice_then_AddedSucessfullyShouldSetToTrue

 public void Given_device_when_RegisterNewDevice_then_AddedSucessfullyShouldSetToTrue()
 {
     var autoMocker=new RhinoAutoMocker<Machine>();
     var device=new Device {ID=1,Name = "printer"};
     autoMocker.ClassUnderTest.RegisterNewDevice(device);
     autoMocker.Get<IDeviceManager>().AssertWasCalled(x => x.AddedSucessfully = true);
 }
开发者ID:inadram,项目名称:TestingApproches,代码行数:7,代码来源:TestMachine.cs

示例7: SetUp

        public virtual void SetUp()
        {
            autoMocker = new RhinoAutoMocker<GameDefinitionController>();
            autoMocker.Get<IGameDefinitionRetriever>()
                .Expect(mock => mock.GetTrendingGames(GameDefinitionController.NUMBER_OF_TRENDING_GAMES_TO_SHOW,
                    GameDefinitionController.NUMBER_OF_DAYS_OF_TRENDING_GAMES))
                    .Return(trendingGames);
            AutomapperConfiguration.Configure();
            urlHelperMock = MockRepository.GenerateMock<UrlHelper>();
            autoMocker.ClassUnderTest.Url = urlHelperMock;
           
            asyncRequestMock = MockRepository.GenerateMock<HttpRequestBase>();
            asyncRequestMock.Expect(x => x.Headers)
                .Repeat.Any()
                .Return(new System.Net.WebHeaderCollection
                {
                    { "X-Requested-With", "XMLHttpRequest" }
                });

            var context = MockRepository.GenerateMock<HttpContextBase>();
            context.Expect(x => x.Request)
                .Repeat.Any()
                .Return(asyncRequestMock);
            autoMocker.ClassUnderTest.ControllerContext = new ControllerContext(context, new RouteData(), autoMocker.ClassUnderTest);
            currentUser = new ApplicationUser()
            {
                Id = "user id",
                CurrentGamingGroupId = 15151
            };
        }
开发者ID:NemeStats,项目名称:NemeStats,代码行数:30,代码来源:GameDefinitionControllerTestBase.cs

示例8: SetUp

		public virtual void SetUp()
		{
            AutomapperConfiguration.Configure();
            autoMocker = new RhinoAutoMocker<PlayerController>();
            autoMocker.PartialMockTheClassUnderTest();
            autoMocker.ClassUnderTest.Url = MockRepository.GenerateMock<UrlHelper>();

            currentUser = new ApplicationUser()
			{
				CurrentGamingGroupId = 123,
				Id = "app user id"
			};

			autoMocker.Get<HttpRequestBase>().Expect(x => x.Headers)
				.Repeat.Any()
				.Return(new System.Net.WebHeaderCollection
                {
                    { "X-Requested-With", "XMLHttpRequest" }
                });

			var context = MockRepository.GenerateMock<HttpContextBase>();
			context.Expect(x => x.Request)
				.Repeat.Any()
				.Return(autoMocker.Get<HttpRequestBase>());

			autoMocker.Get<HttpRequestBase>().Expect(mock => mock.Url)
							.Return(new Uri("https://nemestats.com/Details/1"));

			autoMocker.ClassUnderTest.ControllerContext = new ControllerContext(context, new RouteData(), autoMocker.ClassUnderTest);
			autoMocker.Get<IPlayerSummaryBuilder>().Expect(mock => mock.GetTopPlayers(Arg<int>.Is.Anything)).Return(new List<TopPlayer>());
			autoMocker.Get<INemesisHistoryRetriever>().Expect(mock => mock.GetRecentNemesisChanges(Arg<int>.Is.Anything)).Return(new List<NemesisChange>());
			autoMocker.Get<INemesisChangeViewModelBuilder>().Expect(mock => mock.Build(Arg<List<NemesisChange>>.Is.Anything)).Return(new List<NemesisChangeViewModel>());
			autoMocker.ClassUnderTest.Expect(mock => mock.ShowTopPlayers()).Return(new ViewResult { ViewName = MVC.Player.Views.TopPlayers, ViewData = new ViewDataDictionary(expectedTopPlayersViewModel) });
			autoMocker.ClassUnderTest.Expect(mock => mock.ShowRecentNemesisChanges()).Return(new ViewResult { ViewName = MVC.Player.Views.RecentNemesisChanges, ViewData = new ViewDataDictionary(expectedNemesisChangeViewModel) });
		}
开发者ID:NemeStats,项目名称:NemeStats,代码行数:35,代码来源:PlayerControllerTestBase.cs

示例9: SetUp

        public void SetUp()
        {
            _container = new RhinoAutoMocker<EntryPresenter>();
            _systemUnderTest = _container.ClassUnderTest;
            _entryView = _container.Get<IEntryView>();
            _repository = _container.Get<IRepository>();
            _recentActivities = _container.Get<IRecentActivities>();

              	_recentActivities
              		.Stub(x => x.First)
              		.Return(ACTIVITY);

              	_recentActivities
              		.Stub(x => x.ToArray())
              		.Return(new[]{ ACTIVITY });

              	_entryView
                .Stub(x => x.Duration)
                .Return(DURATION);

            _entryView
                .Stub(x => x.Activity)
                .Return(ACTIVITY);

            _entryView.Stub(x => x.Note).Return(NOTE);
            _entryView.Raise(x => x.KeyDown += null, this, new KeyEventArgs(Keys.Enter));
        }
开发者ID:archnaut,项目名称:sandbox,代码行数:27,代码来源:When_view_is_visible_time_and_task_are_not_null_and_enter_is_pressed.cs

示例10: 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

示例11: BeforeEachTest

 public void BeforeEachTest()
 {
     _firstInput = 0;
     _secondInput = 0;
     var mocker = new RhinoAutoMocker<Calculator>();
     _calculator = mocker.ClassUnderTest;
     _storageService = mocker.Get<IStorageService>();
 }
开发者ID:BarakUgav61,项目名称:Scratch,代码行数:8,代码来源:CalculatorTests.cs

示例12: SetUp

        public void SetUp()
        {
            var services = new RhinoAutoMocker<SampleInputModel>(MockMode.AAA);
            var request = services.Get<IFubuRequest>();

            _policies = new List<IValidationFailurePolicy>();
            _handler = new ValidationFailureHandler(_policies, request);
        }
开发者ID:petejohanson,项目名称:fubumvc,代码行数:8,代码来源:when_handling_validation_failure.cs

示例13: WhenUserSpecifyARemote_ThenReturnIt

 public void WhenUserSpecifyARemote_ThenReturnIt()
 {
     var mocker = new RhinoAutoMocker<IGitRepository>();
     var gitRepoMock = mocker.Get<IGitRepository>();
     var globals = new Globals() { Bootstrapper = null, Stdout = new StringWriter(), Repository = gitRepoMock };
     globals.UserSpecifiedRemoteId = "IWantThatRemote";
     Assert.Equal("IWantThatRemote", globals.RemoteId);
 }
开发者ID:JenasysDesign,项目名称:git-tfs,代码行数:8,代码来源:GlobalsTests.cs

示例14: Setup

        public void Setup()
        {
            _container = new RhinoAutoMocker<EntryPresenter>();
            _systemUnderTest = _container.ClassUnderTest;
            _entryView = _container.Get<IEntryView>();

            _entryView.Raise(x => x.KeyDown += null, this, new KeyEventArgs(Keys.Escape));
        }
开发者ID:archnaut,项目名称:sandbox,代码行数:8,代码来源:When_view_is_visible_and_escape_is_pressed.cs

示例15: SetContext

        protected override void SetContext()
        {
            _mocks = new RhinoAutoMocker<CardReadyAction>();
            _action = _mocks.ClassUnderTest;

            _cardService = _mocks.Get<ICardService>();
            _card = _mocks.Get<Kokugen.Core.Domain.Card>();
        }
开发者ID:rauhryan,项目名称:kokugen,代码行数:8,代码来源:CardReadyAction_Tester.cs


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