Ejemplo n.º 1
0
        public void GivenAUserWallWhenPostIsCalledThenItTimestampsTheMessage()
        {
            var userWall = new UserWall();
            var bob = new User(BobUserHandle, userWall);

            userWall.Post(bob, PostMessageText);

            userWall.Posts(bob).Should().Contain(m => m.Timestamp == SystemTime.Now());
        }
        public void Setup()
        {
            SystemTime.Now = () => new DateTime(2000, 1, 1);

            var userWall = new UserWall();
            var bob = new User("Bob", userWall);
            this.message = new Message(bob, "Bob's message");
            this.formater = new MessageFormater(new ElapsedTimeMessageFormater());
        }
        public void Setup()
        {
            SystemTime.Now = () => new DateTime(2000, 1, 1);

            var userWall = new UserWall();
            var bob = new User(BobUserHandle, userWall);
            this.message = new Message(bob, PostMessageText);
            this.formater = new WallMessageFormater(new MessageFormater(new ElapsedTimeMessageFormater()));
        }
Ejemplo n.º 4
0
        public void GivenAUserWallWhenPostIsCalledThenItSavesThePostMessage()
        {
            var userWall = new UserWall();
            var bob = new User(BobUserHandle, userWall);

            userWall.Post(bob, PostMessageText);

            userWall.Posts(bob).Should().Contain(m => m.Body == PostMessageText);
        }
Ejemplo n.º 5
0
        public void GivenAUserWallWhenPostsIsCalledThenItFiltersPostsForSpecifiedUser()
        {
            var userWall = new UserWall();
            var bob = new User(BobUserHandle, userWall);
            var alice = new User(AliceUserHandle, userWall);

            userWall.Post(bob, string.Format("{0} {1}", BobUserHandle, PostMessageText));
            userWall.Post(alice, string.Format("{0} {1}", AliceUserHandle, PostMessageText));

            userWall.Posts(bob).Should().OnlyContain(m => m.Body == string.Format("{0} {1}", BobUserHandle, PostMessageText));
        }
Ejemplo n.º 6
0
        public void GivenBobHasPostsAndAliceHasPostsAndAliceFollowsBobWhenWeCallAllicesWallThenItAggregatesBobsPosts()
        {
            this.bob = new User(BobUserHandle, new UserWall());
            this.alice = new User(AliceUserHandle, new UserWall());

            this.alice.Post(this.ComposePostMessage(AliceUserHandle, PostMessageText));
            this.bob.Post(this.ComposePostMessage(BobUserHandle, PostMessageText));

            this.bob.AddFollower(this.alice);

            this.alice.Wall.Should().Contain(m => m.Body == this.ComposePostMessage(BobUserHandle, PostMessageText));
        }
        public void SetUp()
        {
            this.repository = Substitute.For<IRepository<IUser>>();
            this.userWall = Substitute.For<IWall>();

            this.broker = new MessageBroker(this.repository);

            this.bob = new User("Bob", this.userWall);
            this.alice = new User("Alice", this.userWall);
        }
Ejemplo n.º 8
0
        public void SetUp()
        {
            SystemTime.Now = () => new DateTime(2000, 1, 1);

            this.consoleMock = Substitute.For<IConsole>();
            this.repositoryMock = Substitute.For<IRepository<IUser>>();
            this.userWallMock = Substitute.For<IWall>();
            this.parserMock = Substitute.For<IInputParser>();
            this.brokerMock = Substitute.For<IMessageBroker>();
            this.formaterFactoryMock = Substitute.For<IMessageFormaterFactory>();

            this.bob = new User("Bob", this.userWallMock);
        }
Ejemplo n.º 9
0
 public void Post(User user, string message)
 {
 }
Ejemplo n.º 10
0
        public void GivenBobHasPostsAndAliceHasPostsAndAliceFollowsBobWhenWeCallAllicesWallThenTheFirstMessageShouldBeTheNewest()
        {
            this.bob = new User(BobUserHandle, new UserWall());
            this.alice = new User(AliceUserHandle, new UserWall());

            this.alice.Post(this.ComposePostMessage(AliceUserHandle, PostMessageText));

            SystemTime.Now = () => new DateTime(2000, 1, 1).AddSeconds(1);

            this.bob.Post(this.ComposePostMessage(BobUserHandle, PostMessageText));

            this.bob.AddFollower(this.alice);

            var firstPost = this.alice.Wall.First();

            firstPost.Body.Should().Be(this.ComposePostMessage(BobUserHandle, PostMessageText));
        }
Ejemplo n.º 11
0
        public void Setup()
        {
            this.userWall = Substitute.For<IWall>();
            this.bob = new User(BobUserHandle, this.userWall);
            this.alice = new User(AliceUserHandle, this.userWall);

            SystemTime.Now = () => new DateTime(2000, 1, 1);
        }