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); }
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); }
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 } }); }
public void Setup() { mocks = new RhinoAutoMocker<Shelve>(); mocks.Inject<TextWriter>(new StringWriter()); mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>(); mocks.MockObjectFactory(); }
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; }
public void SetUp() { _clock = new SettableClock(); Services = new RhinoAutoMocker <T>(_mode); Services.Inject <ISystemTime>(_clock); beforeEach(); }
public static RecordingLogger RecordLogging <T>(this RhinoAutoMocker <T> mocker) where T : class { var logger = new RecordingLogger(); mocker.Inject <ILogger>(logger); return(logger); }
// TODO -- put this into FubuMVC.TestingSupport or whatever it's called public static StubUrlRegistry StubUrls <T>(this RhinoAutoMocker <T> mocker) where T : class { var urls = new StubUrlRegistry(); mocker.Inject <IUrlRegistry>(urls); return(urls); }
public virtual void SetUp() { AutomapperConfiguration.Configure(); _autoMocker = new RhinoAutoMocker <HomeController>(); _autoMocker.Inject <IMapperFactory>(new MapperFactory(new Container(c => { c.AddRegistry <TestRegistry>(); }))); }
private GitTfsRemote BuildRemote(string repository, string url = "", string[] legacyUrls = null, string id = "test") { if (legacyUrls == null) { legacyUrls = new string[0]; } var info = new RemoteInfo { Id = id, Url = url, Repository = repository, Aliases = legacyUrls, }; var mocks = new RhinoAutoMocker <GitTfsRemote>(); mocks.Inject(info); mocks.Inject(MockRepository.GenerateStub <ITfsHelper>()); // GitTfsRemote backs the TfsUrl with this. return(mocks.ClassUnderTest); }
public virtual void SetUp() { AutomapperConfiguration.Configure(); _autoMocker = new RhinoAutoMocker<HomeController>(); _autoMocker.Inject<IMapperFactory>(new MapperFactory(new Container(c => { c.AddRegistry<TestRegistry>(); }))); }
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()); }
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()); }
public void Before_first_test() { _command = new CommandWithOnePrerequisite(); var mocker = new RhinoAutoMocker <CommandHandler>(); mocker.Inject(typeof(ICommand), _command); mocker.Get <IPrerequisiteChecker>() .Expect(x => x.Check(Arg <ICommand> .Is.Same(_command), Arg <ExecutionArguments> .Is.NotNull)) .Return(Notification.ErrorFor("pretend")); _result = mocker.ClassUnderTest.Handle(_command, new ExecutionArguments()); }
private GitTfsRemote BuildSubTreeOwnerRemote(IEnumerable <IGitTfsRemote> remotes) { var info = new RemoteInfo { Id = "test", Url = null, Repository = null, }; var mocks = new RhinoAutoMocker <GitTfsRemote>(); mocks.Inject(info); mocks.Inject(MockRepository.GenerateStub <ITfsHelper>()); // GitTfsRemote backs the TfsUrl with this. var mockGitRepository = mocks.Get <IGitRepository>(); mockGitRepository.Stub(t => t.GetSubtrees(Arg <IGitTfsRemote> .Is.Anything)).Return(remotes); mocks.Inject(new Globals() { Repository = mockGitRepository }); return(mocks.ClassUnderTest); }
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.NET 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(); }
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>(); }
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>(); }
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} }); }
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.NET 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(); }
public HelpTest() { outputWriter = new StringWriter(); mocks = new RhinoAutoMocker <Help>(MockMode.AAA); mocks.Inject <TextWriter>(outputWriter); }
public void SetUp() { autoMocker = new RhinoAutoMocker<NemeStatsDataContext>(); autoMocker.Inject(MockRepository.GenerateMock<NemeStatsDbContext>()); }
public void Setup() { outputWriter = new StringWriter(); mocks = new RhinoAutoMocker <Init>(MockMode.AAA); mocks.Inject <TextWriter>(outputWriter); }
private GitTfsRemote BuildSubTreeOwnerRemote(IEnumerable<IGitTfsRemote> remotes) { var info = new RemoteInfo { Id = "test", Url = null, Repository = null, }; var mocks = new RhinoAutoMocker<GitTfsRemote>(); mocks.Inject(info); mocks.Inject(MockRepository.GenerateStub<ITfsHelper>()); // GitTfsRemote backs the TfsUrl with this. var mockGitRepository = mocks.Get<IGitRepository>(); mockGitRepository.Stub(t => t.GetSubtrees(Arg<IGitTfsRemote>.Is.Anything)).Return(remotes); mocks.Inject(new Globals() { Repository = mockGitRepository }); return mocks.ClassUnderTest; }
public void Setup() { mocks = new RhinoAutoMocker <Shelve>(); mocks.Inject <TextWriter>(new StringWriter()); mocks.Get <Globals>().Repository = mocks.Get <IGitRepository>(); }
public InitBranchTest() { mocks = new RhinoAutoMocker<InitBranch>(); mocks.Inject<TextWriter>(new StringWriter()); mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>(); }
public GitTfsCommandRunnerTests() { _mocks = new RhinoAutoMocker <GitTfsCommandRunner>(MockMode.AAA); _mocks.Inject <TextWriter>(new StringWriter()); }
public void Use <SERVICE>(SERVICE instance) { _services.Inject(instance); }
public ShelveTest() { mocks = new RhinoAutoMocker<Shelve>(); mocks.Inject<TextWriter>(new StringWriter()); mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>(); }
public void SetUp() { autoMocker = new RhinoAutoMocker <NemeStatsDataContext>(); autoMocker.Inject(MockRepository.GenerateMock <NemeStatsDbContext>()); }
public void Setup() { mocks = new RhinoAutoMocker<Pull>(); mocks.Inject<TextWriter>(new StringWriter()); }
public HelpTest() { outputWriter = new StringWriter(); mocks = new RhinoAutoMocker<Help>(MockMode.AAA); mocks.Inject<TextWriter>(outputWriter); }
public void Setup() { _mocks = new RhinoAutoMocker<GitTfsCommandRunner>(MockMode.AAA); _mocks.Inject<TextWriter>(new StringWriter()); }
public InitBranchTest() { mocks = new RhinoAutoMocker <InitBranch>(); mocks.Inject <TextWriter>(new StringWriter()); mocks.Get <Globals>().Repository = mocks.Get <IGitRepository>(); }
public void Setup() { outputWriter = new StringWriter(); mocks = new RhinoAutoMocker<Init>(MockMode.AAA); mocks.Inject<TextWriter>(outputWriter); }