コード例 #1
0
        public void Remove_User_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(inMemoryStorage.Count, 2);

            inMemoryStorage.RemoveUser(guid);

            Assert.AreEqual(inMemoryStorage.Count, 1);
            Assert.AreNotEqual(inMemoryStorage.GetUser(guid2).Id, guid);
        }