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


C# IFixture.Build方法代码示例

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


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

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

示例2: ShouldUpdateTags

			public static void ShouldUpdateTags( [Frozen] SpPortalLicenseApi portalApi, RandomLicenseFromListFixture license, ExistingTagsFixture tags, IFixture fixture )
			{
				var valuesForEachDefinedTag = tags.Tags
					.Select( ct => fixture.Build<SpPortalLicenseApi.LicenseTag>().With( x => x.Id, ct.Id ).CreateAnonymous() )
					.ToList();

				var licenseTagsAssignmentHref = license.Selected._embedded.CustomerTags._links.self.href;
				var apiResult = portalApi.PutLicenseTags( licenseTagsAssignmentHref, valuesForEachDefinedTag );
				Assert.Equal( ResponseStatus.Completed, apiResult.ResponseStatus );
				Assert.Equal( HttpStatusCode.Accepted, apiResult.StatusCode );

				Verify.EventuallyWithBackOff( () =>
				{
					//Retrieve the license again (if it was supported, just GETting the tags subresource would be sufficient to prove the point)
					var updatedLicense = portalApi.GetLicense( license.Selected._links.self.href );

					//Verify that all the tags on the license match
					Assert.Equal( ResponseStatus.Completed, updatedLicense.ResponseStatus );
					Assert.NotNull( updatedLicense.Data._embedded.CustomerTags.results );
					Assert.NotEmpty( updatedLicense.Data._embedded.CustomerTags.results );
					// TOOD use xUnit 1.9 and/or Ploeh.semanticComparison to make this cleaner
					Assert.Equal(
						updatedLicense.Data._embedded.CustomerTags.results.OrderBy( x => x.Id ).Select( x => Tuple.Create( x.Id, x.Value ) ).ToArray(),
						valuesForEachDefinedTag.OrderBy( x => x.Id ).Select( x => Tuple.Create( x.Id, x.Value ) ).ToArray() );
				} );
			}
开发者ID:InishTech,项目名称:Sp.Api,代码行数:26,代码来源:LicenseCustomerTags.cs

示例3: Setup

 public void Setup()
 {
     _fixture = new Fixture().Customize(new AutoMoqCustomization());
     var container = _fixture.Freeze<Mock<IContainer>>();
     _sut =
         _fixture.Build<AutoMappingMapper>().FromFactory(
             () => new AutoMappingMapper(Mapper.Engine, container.Object)).CreateAnonymous();
 }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:8,代码来源:given_a_mapper.cs

示例4: GetApplicationConfiguration

 private static CmdApplicationConfiguration GetApplicationConfiguration(string applicationName, string friendlyName, IFixture fixture)
 {
     // TODO: This can be generalized 
     return fixture.Build<CmdApplicationConfiguration>()
         .FromSeed(a => new CmdApplicationConfiguration(
             (Name)friendlyName,
             (Name)applicationName,
             new System.Collections.ObjectModel.ReadOnlyCollection<IParameter>(new List<IParameter>())))
             .Create();
 }
开发者ID:rahulpnath,项目名称:clal,代码行数:10,代码来源:JsonCmdApplicationConfigurationRepositoryTests.cs

示例5: Customize

            public void Customize(IFixture fixture)
            {
                //we freeze the HttpRequestContext so that the same context is injected into the controller and the request object
                //otherwise, a conflict would happen and an InvalidOperationException would be thrown
                var requestContext = fixture.Build<HttpRequestContext>()
                    .Without(x => x.ClientCertificate)
                    .Create();

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

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

示例7: IdEmptyShouldYieldBadRequest

					public static void IdEmptyShouldYieldBadRequest( SpPortalLicenseApi api, IFixture fixture )
					{
						var badTag = fixture.Build<SpPortalLicenseApi.CustomerTag>().With( x => x.Id, Guid.Empty ).CreateAnonymous();

						var response = api.PutCustomerTags( new[] { badTag } );

						Assert.Equal( HttpStatusCode.BadRequest, response.StatusCode );
					}
开发者ID:InishTech,项目名称:Sp.Api,代码行数:8,代码来源:CustomerTags.cs

示例8: TooLongShouldYieldBadRequest

					public static void TooLongShouldYieldBadRequest( SpPortalLicenseApi api, IFixture fixture )
					{
						var badTag = fixture.Build<SpPortalLicenseApi.CustomerTag>().With( x => x.Name, new String( 'a', 101 ) ).CreateAnonymous();

						var response = api.PutCustomerTags( new[] { badTag } );

						Assert.Equal( HttpStatusCode.BadRequest, response.StatusCode );
					}
开发者ID:InishTech,项目名称:Sp.Api,代码行数:8,代码来源:CustomerTags.cs

示例9: Update_ExistingAdultCustomer_Success_Composed

        public void Update_ExistingAdultCustomer_Success_Composed(
            [AsAdultPersisted] Customer e,
            CustomerManager sut,
            IFixture fixture)
        {
            var data = fixture.Build<CustomerUpdate>()
                .With(x => x.ID, e.ID)
                .Create();

            sut.Update(data);
        }
开发者ID:bardock,项目名称:Bardock.UnitTesting,代码行数:11,代码来源:CustomerManagerTests.cs

示例10: Update_ExistingAdultCustomer_Success

        public void Update_ExistingAdultCustomer_Success(
            //warning: the declaring order of the attrs
            //does not guarantee that customizations will
            //apply in that order, if ordering is required
            //then combine multiple customizations using
            //CompositeCustomizeAttribute like the example
            //below
            [Persisted][AsAdult] Customer e,
            IFixture fixture,
            [Frozen] Mock<ICustomerLogManager> customerLogManager,
            CustomerManager sut)
        {
            var data = fixture.Build<CustomerUpdate>()
                .With(x => x.ID, e.ID)
                .Create();

            sut.Update(data);

            customerLogManager.Verify(x => x.LogUpdate(It.Is<Customer>(c => c.ID == data.ID)));
        }
开发者ID:bardock,项目名称:Bardock.UnitTesting,代码行数:20,代码来源:CustomerManagerTests.cs

示例11: SetUp

            public void SetUp()
            {
                fixture = new Fixture()
                    .Customize(new AutoMoqCustomization());
                maximum = fixture.Create<Position>();
                pieceBagMock = fixture.Freeze<Mock<IPieceBag>>();

                piece = fixture.Build<FakePiece>()
                    .With(x => x.Position, new Position(maximum.X - 1, maximum.Y - 1))
                    .Create();

                occupyingPiece = null;
                pieceBagMock.Setup(x => x.GetPiece(piece.Position))
                    .Returns(() => occupyingPiece);

                contiguousOpponentPiecesMock = fixture.Freeze<Mock<IContiguousOpponentPieces>>();
                fixture.Register(() => new Board(maximum, pieceBagMock.Object, contiguousOpponentPiecesMock.Object));
            }
开发者ID:kenkam,项目名称:reversal,代码行数:18,代码来源:BoardTestFixture.cs

示例12: SetUp

 public void SetUp()
 {
     fixture = new Fixture()
         .Customize(new AutoMoqCustomization());
     pieceBagMock = fixture.Freeze<Mock<IPieceBag>>();
     directionMock = fixture.Freeze<Mock<Direction>>();
     startingPiece = fixture.Build<FakePiece>()
         .With(x => x.Side, Side.Black)
         .Create();
 }
开发者ID:kenkam,项目名称:reversal,代码行数:10,代码来源:ContiguousOpponentPiecesTestFixture.cs

示例13: DuplicateValuesShouldBeRejected

                public static void DuplicateValuesShouldBeRejected( [Frozen] SpPortalLicenseApi portalApi, RandomLicenseFromListFixture license, ExistingTagsFixture tags, IFixture fixture )
				{
					var validTagValue = tags.Tags
						.Select( ct => fixture.Build<SpPortalLicenseApi.LicenseTag>()
							.With( x => x.Id, ct.Id )
							.CreateAnonymous() )
						.Take( 1 )
						.ToArray();

					var theSameValueTwice = validTagValue.Concat( validTagValue ).ToArray();

					var licenseTagsAssignmentHref = license.Selected._embedded.CustomerTags._links.self.href;
					var apiResult = portalApi.PutLicenseTags( licenseTagsAssignmentHref, theSameValueTwice );
					Assert.Equal( ResponseStatus.Completed, apiResult.ResponseStatus );
					Assert.Equal( HttpStatusCode.InternalServerError, apiResult.StatusCode );
				}
开发者ID:InishTech,项目名称:Sp.Api,代码行数:16,代码来源:LicenseCustomerTags.cs

示例14: Setup

 public void Setup()
 {
     _fixture = new Fixture().Customize(new AutoMoqCustomization());
     _sut = _fixture.Build<Configure>().Without(x => x.Container).CreateAnonymous();//.WithVersion_For_Tests();
     _container = _fixture.Freeze<Mock<IContainer>>();
 }
开发者ID:percramer,项目名称:pjsip4net,代码行数:6,代码来源:given_a_configure.cs


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