public void MustValidObject()
        {
            // Given
            var memberFamilyExpected = new
            {
                _memberFamily.DateMarried,
                _memberFamily.Spouse,
                _memberFamily.Father,
                _memberFamily.Mother,
                _memberFamily.Children
            };

            // When
            MemberFamily memberFamily = new MemberFamily(memberFamilyExpected.DateMarried, memberFamilyExpected.Spouse,
                                                         _memberFamily.Father, _memberFamily.Mother, _memberFamily.Children);

            // Then
            memberFamilyExpected.ToExpectedObject().ShouldMatch(memberFamily);
        }
예제 #2
0
        //Dictionary<string, string> data = new Dictionary<string, string>();
        //data.Add("Name", cmd.GroupFamily.Name);
        //    data.Add("Owner", cmd.UserName);
        //    var result = _respository.QueryStoreExecute<int>("ValidateAddFamily @Name, @Owner", data);
        public async Task <ResponseFamilyErrorEnum> Handle(AddGroupFamilyCommand request, CancellationToken cancellationToken)
        {
            if (await _respository.GetFamily(request.GroupFamily.Name) != null)
            {
                return(ResponseFamilyErrorEnum.FamilyNameDuplicate);
            }
            else if (await _respository.GetFamilytoUser(request.UserName) != null)
            {
                return(ResponseFamilyErrorEnum.UserFamilyAlredyExist);
            }
            else
            {
                var member = new MemberFamily(request.UserName, true);
                request.GroupFamily.MembersFamily = new List <MemberFamily>()
                {
                    member
                };
                var add = await _respository.AddGroupFamily(request.GroupFamily);

                var res = await _unitOfWork.Commit();

                return(res > 0 ? ResponseFamilyErrorEnum.Ok : ResponseFamilyErrorEnum.Error);
            }
        }
예제 #3
0
        public async Task <ResponseFamilyErrorEnum> ExitUsertoFamily(DbModel modelFamily, MemberFamily member)
        {
            var family = modelFamily.GroupFamily.Include("MembersFamily").FirstOrDefault(x =>
                                                                                         x.MembersFamily.Any(y => y.UserName == member.UserName));

            family?.MembersFamily.Remove
                (member);
            var result = await modelFamily.SaveChangesAsync();

            if (result != 0)
            {
                return(ResponseFamilyErrorEnum.Ok);
            }
            else
            {
                return(ResponseFamilyErrorEnum.Error);
            }
        }
예제 #4
0
 void addMemberFamily(MemberFamily obj)
 {
     MemberAllInfoViewModel.getInstance().addMemberFamily();
 }
 public MemberFamilyTest()
 {
     _memberFamily = MemberFamilyBuilder.New().Build();
 }
예제 #6
0
 public MemberBuilder WithFamily(MemberFamily family)
 {
     Family = family;
     return(this);
 }