public void Add() { var userId = Guid.NewGuid(); var raceId = Guid.NewGuid(); var team = new Team { RaceId = raceId }; var teamRepositoryMock = new Mock <IGenericRepository <Team> >(); _UnitOfWorkMock.Setup(u => u.TeamRepository).Returns(teamRepositoryMock.Object); TestUtils.SetupUnitOfWorkToPassAuthorizedAndRace(_UnitOfWorkMock, new List <UserLink> { new UserLink() }, raceId); _Sut.Add(userId, team); teamRepositoryMock.Verify(r => r.Get(It.IsAny <Expression <Func <Team, bool> > >(), It.IsAny <Func <IQueryable <Team>, IOrderedQueryable <Team> > >(), It.IsAny <string>()), Times.Exactly(2)); teamRepositoryMock.Verify(r => r.Insert(It.Is <Team>(x => x.Equals(team))), Times.Once); _UnitOfWorkMock.Verify(u => u.Save(), Times.Once); }