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


C# List.ShouldContain方法代码示例

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


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

示例1: for_each_property_invokes_action_on_each_property

 public void for_each_property_invokes_action_on_each_property()
 {
     var props = new List<string>();
     _cache.ForEachProperty(typeof(Item), p=>props.Add(p.Name));
     props.ShouldHaveCount(2);
     props.ShouldContain("Property1");
     props.ShouldContain("Property2");
     props.ShouldNotContain("NonWriteProp");
 }
开发者ID:joshuaflanagan,项目名称:fubumvc,代码行数:9,代码来源:TypeDescriptorCacheTester.cs

示例2: RegisterService_can_be_called_multiple_times_to_store_multiple_implementations

        public void RegisterService_can_be_called_multiple_times_to_store_multiple_implementations()
        {
            var graph = new BehaviorGraph(null);
            graph.Services.AddService<IRequestData, RequestData>();
            graph.Services.AddService<IRequestData, InMemoryRequestData>();

            var implementations = new List<Type>();
            graph.EachService((t, def) => { if (t == typeof (IRequestData)) implementations.Add(def.Type); });

            implementations.ShouldContain(typeof (RequestData));
            implementations.ShouldContain(typeof (InMemoryRequestData));
        }
开发者ID:cmdrkeem,项目名称:fubumvc,代码行数:12,代码来源:BehaviorGraphTester.cs

示例3: ShouldActAsAnEvenFilter

        public void ShouldActAsAnEvenFilter()
        {
            var source = new ObservableCollection<int>();
            var dest = new List<int>();

            source.PushChangesTo(dest).If(NumberIsEven);

            source.Add(1);
            dest.ShouldNotContain(1);

            source.Add(2);
            dest.ShouldContain(2);

            source.Remove(2);
            dest.ShouldNotContain(2);

            dest.Add(1);
            source.Remove(1);
            dest.ShouldContain(1);
        }
开发者ID:gja,项目名称:ListMajik,代码行数:20,代码来源:PushChangesToTest.cs

示例4: ShouldOnlyAddEvenNumbers

        public void ShouldOnlyAddEvenNumbers()
        {
            var source = new ObservableCollection<int>();
            var dest = new List<int>();

            source.PushChangesTo(dest).AddOnlyIf(NumberIsEven);

            source.Add(1);
            dest.ShouldNotContain(1);

            source.Add(2);
            dest.ShouldContain(2);
        }
开发者ID:gja,项目名称:ListMajik,代码行数:13,代码来源:PushChangesToTest.cs

示例5: should_resend_existing_bindings_when_making_a_new_subscription_to_a_type

        public void should_resend_existing_bindings_when_making_a_new_subscription_to_a_type()
        {
            AddInvoker<FakeRoutableCommand>(shouldBeSubscribedOnStartup: false);
            _bus.Subscribe(Subscription.ByExample(x => new FakeRoutableCommand(1, "firstRoutingValue")));
            var subscriptions = new List<SubscriptionsForType>();
            _directoryMock.CaptureEnumerable((IBus)_bus, (x, bus, items) => x.UpdateSubscriptions(bus, items), subscriptions);
            _bus.Start();

            _bus.Subscribe(Subscription.ByExample(x => new FakeRoutableCommand(1, "secondRoutingValue")));

            subscriptions.Count.ShouldEqual(1);
            subscriptions.ShouldContain(new SubscriptionsForType(MessageUtil.TypeId<FakeRoutableCommand>(), new BindingKey("1", "firstRoutingValue", "*"), new BindingKey("1", "secondRoutingValue", "*")));
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:13,代码来源:BusTests.Subscribe.cs

示例6: should_subscribe_to_message_but_not_resend_existing_subscriptions

        public void should_subscribe_to_message_but_not_resend_existing_subscriptions()
        {
            AddInvoker<FakeCommand>(shouldBeSubscribedOnStartup: true);
            AddInvoker<FakeRoutableCommand>(shouldBeSubscribedOnStartup: false);
            var subscriptions = new List<SubscriptionsForType>();
            _directoryMock.CaptureEnumerable((IBus)_bus, (x, bus, items) => x.UpdateSubscriptions(bus, items), subscriptions);

            _bus.Start();
            _bus.Subscribe(Subscription.ByExample(x => new FakeRoutableCommand(1, "name")));

            subscriptions.ExpectedSingle();
            subscriptions.ShouldContain(new SubscriptionsForType(MessageUtil.TypeId<FakeRoutableCommand>(), new BindingKey("1", "name", "*")));
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:13,代码来源:BusTests.Subscribe.cs

示例7: should_subscribe_to_message_for_all_binding_keys

        public void should_subscribe_to_message_for_all_binding_keys()
        {
            AddInvoker<FakeCommand>(shouldBeSubscribedOnStartup: false);
            AddInvoker<FakeRoutableCommand>(shouldBeSubscribedOnStartup: false);
            var subscriptions = new List<SubscriptionsForType>();
            _directoryMock.CaptureEnumerable((IBus)_bus, (x, bus, items) => x.UpdateSubscriptions(bus, items), subscriptions);

            _bus.Start();
            _bus.Subscribe(Subscription.Any<FakeCommand>());

            subscriptions.ExpectedSingle();
            subscriptions.ShouldContain(new SubscriptionsForType(MessageUtil.TypeId<FakeCommand>(), BindingKey.Empty));
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:13,代码来源:BusTests.Subscribe.cs

示例8: ListKeysFromIndexReturnsAllKeys

        public void ListKeysFromIndexReturnsAllKeys()
        {
            var bucket = TestBucket + "_" + Guid.NewGuid().ToString();
            var originalKeyList = new List<string>();

            for (var i = 0; i < 10; i++)
            {
                var o = new RiakObject(bucket, i.ToString(), "{ value: \"this is an object\" }");
                originalKeyList.Add(i.ToString());

                Client.Put(o);
            }

            var result = ((RiakClient)Client).ListKeysFromIndex(bucket);
            var keys = result.Value;

            keys.Count.ShouldEqual(10);

            foreach (var key in keys)
            {
                originalKeyList.ShouldContain(key);
            }

            Client.DeleteBucket(bucket);
        }
开发者ID:TWith2Sugars,项目名称:CorrugatedIron,代码行数:25,代码来源:RiakClientTests.cs

示例9: HandlesExceptionsAsUsual

        public void HandlesExceptionsAsUsual()
        {
            var log = new List<string>();
            var tries = 0;

            adapter.HandleAsync<SomeMessage>(async message =>
            {
                tries++;
                Console.WriteLine("Handling");
                await Task.Yield();
                throw new Exception("failed");
            });

            var bus = StartBus(1, log, numberOfRetries: 5);

            bus.SendLocal(new SomeMessage());

            Thread.Sleep(1000);

            Console.WriteLine("---------------------------------------------------------------------------");
            Console.WriteLine(string.Join(Environment.NewLine, log));
            Console.WriteLine("---------------------------------------------------------------------------");

            log.ShouldContain(x => x.StartsWith("Rebus.Bus.RebusBus|WARN: User exception in Rebus"));
            tries.ShouldBe(5);
        }
开发者ID:nls75,项目名称:Rebus,代码行数:26,代码来源:TestBasicAsyncHandler.cs

示例10: ShouldContainTest

		public void ShouldContainTest()
		{
			IList<string> strings = new List<string> {"test"};
			strings.ShouldContain("test");
		}
开发者ID:abusby,项目名称:nunit.should,代码行数:5,代码来源:ShouldTests.cs

示例11: ShouldPushChangesTo

        public void ShouldPushChangesTo()
        {
            var source = new ObservableCollection<int>();
            var dest = new List<int>();

            source.PushChangesTo(dest);

            source.Add(1);
            dest.ShouldContain(1);

            source.Remove(1);
            dest.ShouldNotContain(1);
        }
开发者ID:gja,项目名称:ListMajik,代码行数:13,代码来源:PushChangesToTest.cs

示例12: ShouldPushChangesToAListGivenAMapping

        public void ShouldPushChangesToAListGivenAMapping()
        {
            var source = new ObservableCollection<int>();
            var dest = new List<float>();

            source.PushChangesTo(dest).WithMapping(i => i);

            source.Add(1);
            dest.ShouldContain(1.00f);

            source.Remove(1);
            dest.ShouldNotContain(1.00f);
        }
开发者ID:gja,项目名称:ListMajik,代码行数:13,代码来源:PushChangesToTest.cs

示例13: ListKeysFromIndexReturnsAllKeys

        public void ListKeysFromIndexReturnsAllKeys()
        {
            const int keyCount = 10;
            const string listKeysBucket = "listKeysBucket";
            var originalKeyList = new List<string>();

            for (var i = 0; i < keyCount; i++)
            {
                string idx = i.ToString();
                var id = new RiakObjectId(TestBucketType, listKeysBucket, idx);
                var o = new RiakObject(id, "{ value: \"this is an object\" }");
                originalKeyList.Add(idx);
                Client.Put(o);
            }

            var result = Client.ListKeysFromIndex(TestBucketType, listKeysBucket);
            var keys = result.Value;

            keys.Count.ShouldEqual(keyCount);

            foreach (var key in keys)
            {
                originalKeyList.ShouldContain(key);
            }

            Client.DeleteBucket(TestBucketType, listKeysBucket);
        }
开发者ID:josephjeganathan,项目名称:riak-dotnet-client,代码行数:27,代码来源:RiakClientTests.cs

示例14: StatsGetPhotostreamStatsAsyncTest

        public void StatsGetPhotostreamStatsAsyncTest()
        {
            Flickr f = TestData.GetAuthInstance();

            var range = Enumerable.Range(7, 5);
            var list = new List<Stats>();

            foreach(var i in range)
            {
                var d = DateTime.Today.AddDays(-i);

                var w = new AsyncSubject<FlickrResult<Stats>>();
                f.StatsGetPhotostreamStatsAsync(d, r => { w.OnNext(r); w.OnCompleted(); });

                var result = w.Next().First();

                result.HasError.ShouldBe(false);
                result.Result.ShouldNotBe(null);

                list.Add(result.Result);
            }

            list.Count.ShouldBe(5);
            list.ShouldContain(s => s.Views > 0);
        }
开发者ID:ericleigh007,项目名称:flickr-net,代码行数:25,代码来源:StatsAsyncTests.cs

示例15: should_not_resend_other_message_subscriptions_when_unsubscribing_from_a_message

        public void should_not_resend_other_message_subscriptions_when_unsubscribing_from_a_message()
        {
            AddInvoker<FakeCommand>(shouldBeSubscribedOnStartup: false);
            AddInvoker<FakeRoutableCommand>(shouldBeSubscribedOnStartup: false);
            _bus.Start();
            var firstSubscription = _bus.Subscribe<FakeCommand>(cmd => {});
            var secondSubscription = _bus.Subscribe(Subscription.ByExample(x => new FakeRoutableCommand(1, "plop")));
            var subscriptions = new List<SubscriptionsForType>();
            _directoryMock.CaptureEnumerable((IBus)_bus, (x, bus, items) => x.UpdateSubscriptions(bus, items), subscriptions);

            firstSubscription.Dispose();

            subscriptions.ExpectedSingle();
            subscriptions.ShouldContain(new SubscriptionsForType(MessageUtil.TypeId<FakeCommand>()));
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:15,代码来源:BusTests.Subscribe.cs


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