コード例 #1
0
        public void Add_Sets_added_story_IsInBucket()
        {
            //Arrange
            var bucket = new SyncableBucket();
            var story  = new Story();

            Assert.IsFalse(story.IsInBucket, "Test assumptions have changed!");

            //Act
            bucket.Add(story);

            //Assert
            Assert.IsTrue(story.IsInBucket);
        }
コード例 #2
0
        public void Add_AddsStory()
        {
            //Arrange
            var bucket = new SyncableBucket();
            var story  = new Mock <Story>();

            //Act
            var countBefore = bucket.Stories.Count;

            bucket.Add(story.Object);


            //Assert
            Assert.AreEqual(countBefore + 1, bucket.Stories.Count);
        }
コード例 #3
0
        public void Adding_Story_triggers_Updated_event_after_Adding_story()
        {
            //Arrange
            var bucket = new SyncableBucket();
            var story  = new Story();

            var   eventWasTriggered = false;
            Story singleStoryInBucketWhenEventTriggered = null;

            bucket.Updated += (o, e) => {
                eventWasTriggered = true;
                singleStoryInBucketWhenEventTriggered = (o as SyncableBucket).Stories.Single();
            };

            //Act
            bucket.Add(story);


            //Assert
            Assert.IsTrue(eventWasTriggered);
            Assert.AreEqual(story, singleStoryInBucketWhenEventTriggered);
        }