本文整理汇总了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);
}
示例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);
}
示例3: Setup
public void Setup()
{
mocks = new RhinoAutoMocker<Shelve>();
mocks.Inject<TextWriter>(new StringWriter());
mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
mocks.MockObjectFactory();
}
示例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;
}
示例5: SetUp
public virtual void SetUp()
{
AutomapperConfiguration.Configure();
_autoMocker = new RhinoAutoMocker<HomeController>();
_autoMocker.Inject<IMapperFactory>(new MapperFactory(new Container(c =>
{
c.AddRegistry<TestRegistry>();
})));
}
示例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());
}
示例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.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();
}
示例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>();
}
示例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}
});
}
示例10: Setup
public void Setup()
{
_mocks = new RhinoAutoMocker<GitTfsCommandRunner>(MockMode.AAA);
_mocks.Inject<TextWriter>(new StringWriter());
}
示例11: ShelveTest
public ShelveTest()
{
mocks = new RhinoAutoMocker<Shelve>();
mocks.Inject<TextWriter>(new StringWriter());
mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
}
示例12: Setup
public void Setup()
{
mocks = new RhinoAutoMocker<Pull>();
mocks.Inject<TextWriter>(new StringWriter());
}
示例13: Setup
public void Setup()
{
outputWriter = new StringWriter();
mocks = new RhinoAutoMocker<Init>(MockMode.AAA);
mocks.Inject<TextWriter>(outputWriter);
}
示例14: SetUp
public void SetUp()
{
autoMocker = new RhinoAutoMocker<NemeStatsDataContext>();
autoMocker.Inject(MockRepository.GenerateMock<NemeStatsDbContext>());
}
示例15: InitBranchTest
public InitBranchTest()
{
mocks = new RhinoAutoMocker<InitBranch>();
mocks.Inject<TextWriter>(new StringWriter());
mocks.Get<Globals>().Repository = mocks.Get<IGitRepository>();
}