Example #1
0
        public void RepoEnsureICanAddInviteToDB()
        {
            List <TeamInvite> inviteDB = new List <TeamInvite>
            {
                new TeamInvite {
                    TeamInviteID = 0
                },
                new TeamInvite {
                    TeamInviteID = 1
                },
                new TeamInvite {
                    TeamInviteID = 2
                }
            };
            TeamInvite testInvite = new TeamInvite {
                TeamInviteID = 3
            };

            _inviteSet.Object.AddRange(inviteDB);
            ConnectMocksToDataStore(inviteDB);
            _inviteSet.Setup(o => o.Add(It.IsAny <TeamInvite>())).Callback((TeamInvite i) => inviteDB.Add(i));

            bool result = _repo.AddTeamInvite(testInvite);
            List <TeamInvite> actual   = _repo.GetAllTeamInvites();
            List <TeamInvite> expected = new List <TeamInvite>
            {
                new TeamInvite {
                    TeamInviteID = 0
                },
                new TeamInvite {
                    TeamInviteID = 1
                },
                new TeamInvite {
                    TeamInviteID = 2
                },
                testInvite
            };

            Assert.IsTrue(result);
            CollectionAssert.AreEqual(expected, actual);
        }