예제 #1
0
        public void RepoEnsureICanAddGamerToDB()
        {
            List <Gamer> expected = new List <Gamer> {
                new Gamer {
                    GamerID = 0
                }
            };
            Gamer me = new Gamer {
                GamerID = 1
            };

            _gamerSet.Object.AddRange(expected);
            ConnectMocksToDataStore(expected);
            _gamerSet.Setup(o => o.Add(It.IsAny <Gamer>())).Callback((Gamer g) => expected.Add(g));

            bool actual = _repo.AddGamer(me);

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