當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。