本文整理汇总了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");
}
示例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));
}
示例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);
}
示例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);
}
示例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", "*")));
}
示例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", "*")));
}
示例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));
}
示例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);
}
示例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);
}
示例10: ShouldContainTest
public void ShouldContainTest()
{
IList<string> strings = new List<string> {"test"};
strings.ShouldContain("test");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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>()));
}