Exemplo n.º 1
0
        public void RepositoryTestsEnsureICanCreateANewPost()
        {
            Gamer me = new Gamer {
                GamerID = 1
            };
            string       input = "This is my post";
            List <Posts> posts = new List <Posts> {
                new Posts {
                    PostsID = 1, Author = me, Content = "blah"
                }
            };

            _postSet.Object.AddRange(posts);
            ConnectMocksToDataStore(posts);
            _postSet.Setup(o => o.Add(It.IsAny <Posts>())).Callback((Posts p) => posts.Add(p));

            bool actual = _repo.CreateAPost(me, input);

            Assert.IsTrue(actual);
            Assert.AreEqual(2, posts.Count);
        }