Пример #1
0
        public void AddAsyncInvalid()
        {
            IWatchListProvider provider = GetProvider();

            Assert.Throws <ArgumentNullException> (() => provider.AddAsync(null, new Person("buddyId")));
            Assert.Throws <ArgumentNullException> (() => provider.AddAsync(new Person("ownerId"), null));
        }
Пример #2
0
        public void AddAsync()
        {
            IWatchListProvider provider = GetProvider();

            provider.AddAsync(personA, personB).Wait();
            provider.AddAsync(personA, personC).Wait();

            IEnumerable <Person> buddies = provider.GetWatchedAsync(personA.Identity).Result;

            CollectionAssert.Contains(buddies, personB);
            CollectionAssert.Contains(buddies, personC);
        }
Пример #3
0
        public void ClearAsync()
        {
            IWatchListProvider provider = GetProvider();

            provider.AddAsync(personA, personB).Wait();
            provider.AddAsync(personA, personC).Wait();

            provider.ClearAsync(personA.Identity).Wait();

            IEnumerable <Person> buddies = provider.GetWatchedAsync(personA.Identity).Result;

            Assert.IsNotNull(buddies);
            CollectionAssert.IsEmpty(buddies);
        }
Пример #4
0
        public void GetIsWatcherAsync()
        {
            IWatchListProvider provider = GetProvider();

            provider.AddAsync(personA, personB).Wait();

            Assert.That(provider.GetIsWatcherAsync(personA.Identity, personB.Identity).Result, Is.True);
            Assert.That(provider.GetIsWatcherAsync(personB.Identity, personA.Identity).Result, Is.False);
        }