Exemplo n.º 1
0
        public void TestForAddMembers()
        {
            //arrange
            TeamMember memberObject = new TeamMember()
            {
                Id = 101, MemberId = 11, TeamId = 1
            };
            List <TeamMember> member = new List <TeamMember>();
            var mockRepo             = new Mock <ITeamRepo>();

            mockRepo.Setup(m => m.AddMembers(memberObject));
            TeamService serObj = new TeamService(mockRepo.Object);

            //Act
            serObj.AddMembers(memberObject);
            //Assert
        }
Exemplo n.º 2
0
        public void TeamsService_addMember_should_Throw_NullReferenceException()
        {
            //arrange
            TeamMember member = new TeamMember()
            {
                TeamId = 1
            };
            List <TeamMember> team = new List <TeamMember>();

            team.Add(member);
            var mockRepo = new Mock <ITeamRepo>();

            mockRepo.Setup(m => m.AddMembers(It.IsAny <TeamMember>())).Throws(new NullReferenceException());
            TeamService teamService = new TeamService(mockRepo.Object);

            //act
            var ex = Record.Exception(() => teamService.AddMembers(member));

            //assert
            Assert.IsType <NullReferenceException>(ex);
        }