Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }