public void AddMemberToFamily_Throws_Exception_When_FamilyMember_Is_Null()
        {
            //Arrange.
            var mockRepository = new Mock <IFamilyRepository>();

            mockRepository.Setup(c => c.AddMember(-1, It.IsAny <FamilyMember>()));//.Throws(new ArgumentException());

            var familyService = new FamilyService(mockRepository.Object);

            //Act.
            familyService.AddMemberToFamily(1, null);

            //Assert.
        }
        public void AddMemberToFamily_Throws_Exception_When_FamilyMember_FirstName_Longer_Than_32()
        {
            //Arrange.
            var moqRepo = new Mock <IFamilyRepository>();

            moqRepo.Setup(c => c.AddMember(It.IsAny <int>(), It.IsAny <FamilyMember>()));

            var service = new FamilyService(moqRepo.Object);

            //Act.
            service.AddMemberToFamily(1, new FamilyMember {
                FirstName = "12345678901234567890_12345678901234567890"
            });
        }
        public void AddMemberToFamily_Calls_AddMember_When_FamilyId_Valid()
        {
            //Arrange.
            var mockRepository = new Mock <IFamilyRepository>();

            mockRepository.Setup(c => c.AddMember(It.IsAny <int>(), It.IsAny <FamilyMember>()));

            var familyService = new FamilyService(mockRepository.Object);

            //Act.
            familyService.AddMemberToFamily(1, new FamilyMember());

            //Assert.
            mockRepository.VerifyAll();
        }
        public void AddMemberToFamily_Throws_Exception_When_FamilyId_Is_Negative()
        {
            //Arrange.
            var mockRepository = new Mock <IFamilyRepository>();

            mockRepository.Setup(c => c.AddMember(-1, It.IsAny <FamilyMember>()));//.Throws(new ArgumentException());

            var familyService = new FamilyService(mockRepository.Object);

            //Act.
            familyService.AddMemberToFamily(-1, new FamilyMember {
                FirstName = "KK", LastName = "aa", IsActive = true
            });

            //Assert.
        }
        public void AddMemberToFamily_Calls_Repository_Method_AddMember_With_Apropriete_Parameters()
        {
            //Arrange.
            var mockRepository = new Mock <IFamilyRepository>();

            mockRepository.Setup(c => c.AddMember(It.IsAny <int>(), It.IsAny <FamilyMember>()));

            var familyService = new FamilyService(mockRepository.Object);

            var memberToAdd = new FamilyMember();

            //Act.
            familyService.AddMemberToFamily(1, memberToAdd);

            //Assert.
            mockRepository.Verify(x => x.AddMember(
                                      It.Is <int>(fn => fn.Equals(1)), It.Is <FamilyMember>(fn => fn.Equals(memberToAdd)))
                                  );
        }