本文整理汇总了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());
}
示例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);
}
示例3: Establish_Context
public void Establish_Context()
{
_mocks = new RhinoAutoMocker<TodoListRepository>();
_repository = _mocks.ClassUnderTest;
_repository.Add(new TodoListItem());
}
示例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);
}
示例5: SetupFixtureContext
protected override void SetupFixtureContext()
{
_mocks = new RhinoAutoMocker<VideosController>();
Controller = _mocks.ClassUnderTest;
_video = new Video() {Id = Guid.NewGuid()};
}
示例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);
}
示例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
};
}
示例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) });
}
示例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();
}
示例11: BeforeEachTest
public void BeforeEachTest()
{
_firstInput = 0;
_secondInput = 0;
var mocker = new RhinoAutoMocker<Calculator>();
_calculator = mocker.ClassUnderTest;
_storageService = mocker.Get<IStorageService>();
}
示例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);
}
示例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);
}
示例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));
}
示例15: SetContext
protected override void SetContext()
{
_mocks = new RhinoAutoMocker<CardReadyAction>();
_action = _mocks.ClassUnderTest;
_cardService = _mocks.Get<ICardService>();
_card = _mocks.Get<Kokugen.Core.Domain.Card>();
}