Esempio n. 1
0
        public void AddMatch_Doesnt_Save_Match_When_GuestId_And_HostId_Are_Equal()
        {
            Match match = new Match()
            {
                HostTeam  = host,
                HostId    = 1,
                GuestTeam = host,
                GuestId   = 1
            };

            Assert.Throws <ArgumentException>(() => matchService.AddMatch(match));
        }
Esempio n. 2
0
        public void AddMatch_Doesnt_Save_Match_When_HostTeam_Doesnt_have_Enough_Players()
        {
            host.Players = new List <Player>();

            Match match = new Match()
            {
                HostTeam  = host,
                HostId    = 1,
                GuestTeam = guest,
                GuestId   = 2
            };

            Assert.Throws <ArgumentException>(() => matchService.AddMatch(match));
        }
Esempio n. 3
0
        public void AddMatch_Saves_Match()
        {
            Match match = new Match()
            {
                HostTeam  = host,
                HostId    = 1,
                GuestTeam = guest,
                GuestId   = 2
            };

            matchService.AddMatch(match);

            matchSet.Verify(m => m.Add(It.IsAny <Match>()), Times.Once());
            mockContext.Verify(m => m.SaveChanges(), Times.Once());
        }