Пример #1
0
 public ArchiveTweetCommand(Tweet tweet)
 {
     _tweet = tweet;
     _observer = new PropertyObserver<Tweet>(_tweet).
         RegisterHandler(x => x.IsArchived,
                         x => CanExecuteChanged(this, EventArgs.Empty));
 }
Пример #2
0
        public void MarkAsRead__UpdatesIsRead()
        {
            var test = new Tweet();

            test.
                AssertThatChangeNotificationIsRaisedBy(x => x.IsRead).
                When(test.MarkAsRead);
        }
Пример #3
0
        public void Archive__UpdatesIsArchived()
        {
            var test = new Tweet();

            test.
                AssertThatChangeNotificationIsRaisedBy(x => x.IsArchived).
                When(test.Archive);
        }
Пример #4
0
 public bool AddTweet(Tweet tweet)
 {
     if (_store.AddTweet(tweet))
     {
         _newTweets.OnNext(tweet.Id);
         return true;
     }
     return false;
 }
Пример #5
0
        public bool AddTweet(Tweet tweet)
        {
            lock (_mutex)
                using (IDocumentSession session = _documentStore.OpenSession())
                {
                    var existingEntry = session.Load<Tweet>(tweet.Id);

                    if (existingEntry == null)
                    {
                        session.Store(tweet);
                        session.SaveChanges();
                        return true;
                    }
                }
            return false;
        }
Пример #6
0
 public bool AddTweet(Tweet tweet)
 {
     return _tweets.TryAdd(tweet.Id, tweet);
 }
Пример #7
0
 public void GettingIsRead_Initially_IsFalse()
 {
     var test = new Tweet();
     Assert.False(test.IsRead);
 }