Beispiel #1
0
        public void Clear_Users_Storage_InMemory_Tests_Method()
        {
            InMemoryStorage inMemoryStorage = new InMemoryStorage();

            Guid           guid = Guid.NewGuid();
            DomainUserItem user = new DomainUserItem()
            {
                ChatId             = 12345678,
                DateOfRegistration = DateTimeOffset.Now,
                FirstName          = "Null",
                Id      = guid,
                Message = "Null",
                Status  = StatusEnum.Null
            };
            Guid           guid2 = Guid.NewGuid();
            DomainUserItem user2 = new DomainUserItem()
            {
                ChatId             = 12345678,
                DateOfRegistration = DateTimeOffset.Now,
                FirstName          = "Null",
                Id      = guid2,
                Message = "Null",
                Status  = StatusEnum.Null
            };

            inMemoryStorage.AddUser(user);
            inMemoryStorage.AddUser(user2);

            Assert.AreEqual(2, inMemoryStorage.Count);

            inMemoryStorage.Clear();

            Assert.AreEqual(0, inMemoryStorage.Count);
        }
        public void InitializeTest()
        {
            var memoryStorage = new InMemoryStorage();

            memoryStorage.Clear();
            Assert.AreEqual(memoryStorage.Count(), 0);
        }
        public async void Clear_OneSavedEntryCleared_EntriesIsEmpty()
        {
            var entry = new Uri("fake://a");
            await storage.Save(entry, "");

            await storage.Clear();

            storage.Entries.Should().BeEmpty();
        }
        public void ClearTest()
        {
            var memoryStorage = new InMemoryStorage();
            var item          = new ReminderItem();
            var id            = Guid.NewGuid();

            memoryStorage.Add(id, item);
            var id2   = Guid.NewGuid();
            var item2 = new ReminderItem();

            memoryStorage.Add(id2, item2);

            Assert.AreEqual(memoryStorage.Count(), 2);

            memoryStorage.Clear();

            Assert.AreEqual(memoryStorage.Count(), 0);
        }