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


C# Fixture.AddManyTo方法代码示例

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


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

示例1: Should_use_messagechannel_from_modulecatalog_when_started

        public void Should_use_messagechannel_from_modulecatalog_when_started()
        {
            var fixture = new Fixture().Customize(new TestConventions());
            var catalog = fixture.Freeze<DriverCatalog>();
            fixture.AddManyTo(catalog.MessageStores, 1);
            fixture.AddManyTo(catalog.MessageChannels, 1);
            var sut = fixture.CreateAnonymous<HaywireServer>();

            sut.Start();

            Assert.AreEqual(catalog.MessageChannels.Single(), sut.MessageChannel);
        }
开发者ID:kellabyte,项目名称:HaywireMQ,代码行数:12,代码来源:HaywireServerTests.cs

示例2: Should_have_same_messagequeue_as_messagestore_when_started

        public void Should_have_same_messagequeue_as_messagestore_when_started()
        {
            var fixture = new Fixture().Customize(new TestConventions());
            var catalog = fixture.Freeze<DriverCatalog>();
            fixture.AddManyTo(catalog.MessageStores, 1);
            fixture.AddManyTo(catalog.MessageChannels, 1);
            List<string> ids = fixture.CreateMany<string>(1).ToList();
            A.CallTo(() => catalog.MessageStores.Single().GetQueues()).Returns(ids);
            var sut = fixture.CreateAnonymous<HaywireServer>();

            sut.Start();

            Assert.AreEqual(ids.First(), sut.MessageQueues[0].Id);
        }
开发者ID:kellabyte,项目名称:HaywireMQ,代码行数:14,代码来源:HaywireServerTests.cs

示例3: PopulateListAfterCreation

 public void PopulateListAfterCreation()
 {
     var fixture = new Fixture();
     var list = fixture.CreateAnonymous<List<int>>();
     fixture.AddManyTo(list);
     Assert.True(list.Any());
 }
开发者ID:rajeshgupthar,项目名称:AutoFixture,代码行数:7,代码来源:Scenario.cs

示例4: AddManyInstancesToList

        public void AddManyInstancesToList()
        {
            Fixture fixture = new Fixture();
            var list = new List<MyClass>();
            fixture.AddManyTo(list);

            Assert.True(list.Count > 1, "Multiple instances");
        }
开发者ID:jamesfoster,项目名称:AutoFixture,代码行数:8,代码来源:DocumentationExample.cs

示例5: AddManyInstancesUsingCustomCreator

        public void AddManyInstancesUsingCustomCreator()
        {
            Fixture fixture = new Fixture();
            var list = new List<int>();
            var r = new Random();
            fixture.AddManyTo(list, () => r.Next());

            Assert.True(list.Count > 1, "Multiple instances");
        }
开发者ID:jamesfoster,项目名称:AutoFixture,代码行数:9,代码来源:DocumentationExample.cs

示例6: AddAnExplicitNumberOfInstancesToList

        public void AddAnExplicitNumberOfInstancesToList()
        {
            Fixture fixture = new Fixture();
            var list = new List<MyClass>();
            fixture.RepeatCount = 7;
            fixture.AddManyTo(list);

            Assert.Equal<int>(fixture.RepeatCount, list.Count);
        }
开发者ID:jamesfoster,项目名称:AutoFixture,代码行数:9,代码来源:DocumentationExample.cs

示例7: CreateAnonymousOrderAndThenAddOrderLines

 public void CreateAnonymousOrderAndThenAddOrderLines()
 {
     // Fixture setup
     var fixture = new Fixture();
     // Exercise system
     var order = fixture.CreateAnonymous<Order>();
     fixture.AddManyTo(order.OrderLines);
     Assert.Equal<int>(fixture.RepeatCount, order.OrderLines.Count);
     // Teardown
 }
开发者ID:rajeshgupthar,项目名称:AutoFixture,代码行数:10,代码来源:OrderTest.cs

示例8: AddManyWillAddItemsToCollection

 public void AddManyWillAddItemsToCollection()
 {
     // Fixture setup
     Fixture sut = new Fixture();
     int expectedCount = sut.RepeatCount;
     ICollection<int> collection = new LinkedList<int>();
     // Exercise system
     sut.AddManyTo(collection);
     // Verify outcome
     Assert.Equal<int>(expectedCount, collection.Count);
     // Teardown
 }
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:12,代码来源:FixtureTest.cs

示例9: BuildOrderWithManyOrderLines

 public void BuildOrderWithManyOrderLines()
 {
     // Fixture setup
     var fixture = new Fixture();
     // Exercise system
     var order = fixture.Build<Order>()
         .Do(o => fixture.AddManyTo(o.OrderLines))
         .CreateAnonymous();
     // Verify outcome
     Assert.Equal<int>(fixture.RepeatCount, order.OrderLines.Count);
     // Teardown
 }
开发者ID:rajeshgupthar,项目名称:AutoFixture,代码行数:12,代码来源:OrderTest.cs

示例10: AddManyWillAddItemsToListUsingCreator

 public void AddManyWillAddItemsToListUsingCreator()
 {
     // Fixture setup
     Fixture sut = new Fixture();
     IEnumerable<int> expectedList = Enumerable.Range(1, sut.RepeatCount);
     List<int> list = new List<int>();
     // Exercise system
     int i = 0;
     sut.AddManyTo(list, () => ++i);
     // Verify outcome
     Assert.True(expectedList.SequenceEqual(list));
     // Teardown
 }
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:13,代码来源:FixtureTest.cs

示例11: AddManyWillAddItemsToListUsingAnonymousCreator

 public void AddManyWillAddItemsToListUsingAnonymousCreator()
 {
     // Fixture setup
     Fixture sut = new Fixture();
     int expectedItemCount = sut.RepeatCount;
     List<string> list = new List<string>();
     // Exercise system
     sut.AddManyTo(list);
     // Verify outcome
     int result = (from s in list
                   where !string.IsNullOrEmpty(s)
                   select s).Count();
     Assert.Equal<int>(expectedItemCount, result);
     // Teardown
 }
开发者ID:dhilgarth,项目名称:AutoFixture,代码行数:15,代码来源:FixtureTest.cs

示例12: TotalIsCorrect

 public void TotalIsCorrect()
 {
     // Fixture setup
     var fixture = new Fixture().Customize(new AutoMoqCustomization());
     var basket = fixture.Freeze<Basket>();
     fixture.AddManyTo(basket.Contents);
     var sut = fixture.Build<BasketView>().OmitAutoProperties().CreateAnonymous();
     // Exercise system
     decimal result = sut.Total;
     // Verify outcome
     var expectedResult = (from e in basket.Contents
                           select e.Total.Amount).Sum();
     Assert.Equal(expectedResult, result);
     // Teardown
 }
开发者ID:mesta1,项目名称:dli.net_sourcecode,代码行数:15,代码来源:BasketViewTest.cs

示例13: Main

        static void Main(string[] args)
        {
            // 01. Pierwszy fixture
            Fixture fixture = new Fixture();
            var person = fixture.Create<Person>();

            Console.WriteLine(person);

            // 02. Wygenerowanie listy obiektów

            List<Person> list = new List<Person>(50);
            for (int i = 0; i < 50; i++)
            {
                list.Add(fixture.Create<Person>());
            }

            // 03. Automatyczne wygenerowanie listy obiektów przez AutoFixture
            int count = 50;
            fixture.RepeatCount = 50;
            List<Person> list2 = new List<Person>(count);
            fixture.AddManyTo(list2);

            Console.ReadKey(true);
        }
开发者ID:prasolinho,项目名称:AutoFixtureExamples,代码行数:24,代码来源:Program.cs

示例14: UpdatedIsCorrect

        public void UpdatedIsCorrect()
        {
            // Fixture setup
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var sut = fixture.CreateAnonymous<Basket>();
            fixture.AddManyTo(sut.Contents);
            // Exercise system
            DateTimeOffset result = sut.Updated;
            // Verify outcome
            var expectedUpdate = (from e in sut.Contents
                                  select e.Updated).Max();
            Assert.Equal(expectedUpdate, result);
            // Teardown
        }
开发者ID:mesta1,项目名称:dli.net_sourcecode,代码行数:15,代码来源:BasketTest.cs

示例15: AutoFixture_CreateMany

        public void AutoFixture_CreateMany()
        {
            Fixture fixture = new Fixture();
            List<FileParameterDescriptor> list1 = new List<FileParameterDescriptor>(); 
            fixture.AddManyTo(list1, 10);
                                                                                //DEMO show list of items by OzCode
            Assert.That(list1.Count, Is.EqualTo(10));

            List<IParameterDescriptor> list2 = new List<IParameterDescriptor>();
                                                                                //DEMO fixture.Register<IParameterDescriptor>(fixture.Create<FileParameterDescriptor>);
            fixture.AddManyTo(list2, 10);
            Assert.That(list2.Count, Is.EqualTo(10));
        }
开发者ID:constructor-igor,项目名称:TechSugar,代码行数:13,代码来源:TechSugarDemoTests.cs


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