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


C# IFixture.Inject方法代码示例

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


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

示例1: NullForCtorArgumentsThrowsException

 public void NullForCtorArgumentsThrowsException(IFixture fixture, Name name)
 {
     fixture.Inject<IParameter>(new ParameterTest());
     fixture.Inject<ParameterMeta>(ParameterMeta.Create<IParameter>(name));
     var assertion = new GuardClauseAssertion(fixture);
     assertion.Verify(typeof(CmdApplicationConfiguration).GetConstructors());
 }
开发者ID:rahulpnath,项目名称:clal,代码行数:7,代码来源:CmdApplicationConfigurationTest.cs

示例2: CtorParametersAreInitialized

 public void CtorParametersAreInitialized(IFixture fixture, Name name)
 {
     fixture.Inject<IParameter>(new ParameterTest());
     fixture.Inject<ParameterMeta>(ParameterMeta.Create<IParameter>(name));
     var assertion = new ConstructorInitializedMemberAssertion(fixture);
     assertion.Verify(typeof(CmdApplicationConfiguration));
 }
开发者ID:rahulpnath,项目名称:clal,代码行数:7,代码来源:CmdApplicationConfigurationTest.cs

示例3: MessageProcessingAsyncWrapper

 public MessageProcessingAsyncWrapper()
 {
     _fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
     ReceiveMessages = _fixture.Create<IReceiveMessagesFactory>();
     MessageContextFactory = _fixture.Create<IMessageContextFactory>();
     _fixture.Inject(ReceiveMessages);
     _fixture.Inject(MessageContextFactory);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:8,代码来源:MessageProcessingAsyncTests.cs

示例4: Customize

 public void Customize(IFixture fixture)
 {
   var database = Database.GetDatabase("master");
   fixture.Inject(database);
   fixture.Inject(Substitute.For<DataStorage>(database));
   fixture.Register(ItemHelper.CreateInstance);
   fixture.Register(() => Language.Parse("en"));
 }
开发者ID:dharnitski,项目名称:Sitecore.FakeDb,代码行数:8,代码来源:DefaultAutoDataAttribute.cs

示例5: Customize

 public void Customize(IFixture fixture)
 {
     fixture.Inject<Func<bool>>(() => false);
     fixture.Inject<Func<object, bool>>(x => false);
     fixture.Inject<Func<string, bool>>(x => false);
     fixture.Inject<Func<int, bool>>(x => false);
     fixture.Inject<Func<Version, bool>>(x => false);
 }
开发者ID:ploeh,项目名称:CQRSonAzureDemo,代码行数:8,代码来源:FuncCustomization.cs

示例6: MessageProcessingWrapper

 public MessageProcessingWrapper()
 {
     _fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
     ReceiveMessages = _fixture.Create<IReceiveMessages>();
     var factory = _fixture.Create<IReceiveMessagesFactory>();
     factory.Create().ReturnsForAnyArgs(ReceiveMessages);
     _fixture.Inject(factory);
     MessageContextFactory = _fixture.Create<IMessageContextFactory>();
     _fixture.Inject(ReceiveMessages);
     _fixture.Inject(MessageContextFactory);
 }
开发者ID:blehnen,项目名称:DotNetWorkQueue,代码行数:11,代码来源:MessageProcessingTests.cs

示例7: CreateMainViewModel

 private MainViewModel CreateMainViewModel(IFixture fixture, IMessenger messenger = null)
 {
     var channel = fixture.Create<IChannel<SaveCmdApplicationConfigurationCommand>>();
     fixture.Register<ICmdApplicationConfigurationViewModelFactory>(() => fixture.Create<CmdApplicationConfigurationViewModelFactory>());
     fixture.Inject(messenger ?? new Messenger());
     return fixture.Build<MainViewModel>().OmitAutoProperties().Create();
 }
开发者ID:rahulpnath,项目名称:clal,代码行数:7,代码来源:MainViewModelTests.cs

示例8: Customize

 public void Customize(IFixture fixture)
 {
     fixture.Customize<ModelBindingContext>(c => c
         .Without(x => x.Model)
         .Without(x => x.ModelType));
     fixture.Inject(CultureInfo.CurrentCulture);
 }
开发者ID:Winsto,项目名称:Booking,代码行数:7,代码来源:WebModelCustomization.cs

示例9: ConstructWithNullLoggerThrows

 public void ConstructWithNullLoggerThrows(
     IFixture fixture)
 {
     fixture.Inject<ILogger>(null);
     var e = Assert.Throws<TargetInvocationException>(() => fixture.Create<NotifyErrorAttribute>());
     Assert.IsType<ArgumentNullException>(e.InnerException);
 }
开发者ID:jwChung,项目名称:TfsBuilder,代码行数:7,代码来源:NotifyErrorAttributeTest.cs

示例10: Customize

            public void Customize(IFixture fixture)
            {
                var mock = new Mock<HttpRequestBase>(MockBehavior.Strict);
                mock.Setup(r => r.UserHostAddress).Returns("127.0.0.1");

                fixture.Inject(mock);
            }
开发者ID:hbiarge,项目名称:Testing-HackLab,代码行数:7,代码来源:HttpMocksCustomization.cs

示例11: PropertiesAreCorrectlyInitialized

 public void PropertiesAreCorrectlyInitialized(IFixture fixture, ConstructorInitializedMemberAssertion assertion)
 {
     // Fixture setup
     fixture.Inject(JSendStatus.Error);
     var properties = typeof (JSendError).GetProperties();
     // Exercise system and verify outcome
     assertion.Verify(properties);
 }
开发者ID:lofrank,项目名称:JSendWebApi,代码行数:8,代码来源:JSendErrorTests.cs

示例12: Customize

            public void Customize(IFixture fixture)
            {
                var urlFactoryMock = new Mock<UrlHelper>();
                urlFactoryMock.Setup(x => x.Link(It.IsAny<string>(), It.IsAny<IDictionary<string, object>>()))
                    .Returns((string name, IDictionary<string, object> values) => RouteLink);

                fixture.Inject(urlFactoryMock.Object);
            }
开发者ID:lofrank,项目名称:JSendWebApi,代码行数:8,代码来源:TestConventions.cs

示例13: Customize

    public void Customize(IFixture fixture)
    {

      foreach (var customization in fixture.Customizations.Where(c => c is NodeComposer<Db>))
      {
        fixture.Customizations.Remove(customization);
      }

      fixture.Inject(new Db("core"));
    }
开发者ID:GoranHalvarsson,项目名称:Habitat,代码行数:10,代码来源:CoreDbCustomization.cs

示例14: GetApplicationConfigurationMeta

 private CmdApplicationMeta GetApplicationConfigurationMeta(string applicationName, string friendlyName, IFixture fixture)
 {
     // TODO: This can be generalized 
     fixture.Inject<Type>(typeof(IParameter));
     return fixture.Build<CmdApplicationMeta>()
         .FromSeed(a => new CmdApplicationMeta(
             (Name)friendlyName,
             (Name)applicationName,
             new List<ParameterMeta>()))
             .Create();
 }
开发者ID:rahulpnath,项目名称:clal,代码行数:11,代码来源:CmdApplicationMetaTests.cs

示例15: Setup

        public void Setup()
        {
            _autofixture = new Fixture();
              new TalesModelCustomisation().Customize(_autofixture);

              _pathEvaluator = new Mock<IExpressionEvaluator>();
              var registry = new Mock<IEvaluatorSelector>();
              _autofixture.Inject(registry.Object);
              _model = _autofixture.Create<TalesModel>();

              registry.Setup(x => x.GetEvaluator<PathExpressionEvaluator>()).Returns(_pathEvaluator.Object);

              _sut = new StringExpressionEvaluator(registry.Object);
        }
开发者ID:csf-dev,项目名称:ZPT-Sharp,代码行数:14,代码来源:TestStringExpressionEvaluator.cs


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