public void GivenMemberMapper_WhenMapMemberToMemberModel_ShouldMapSuccessful(long id, decimal monthlyExpense, decimal monthlySalary, string name, string emailAddress) { // assign var memberAccounts = new List <MemberAccount> { MemberDataBuilder.CreateMemberAccount(1, id, 2), }; var memberExpense = MemberDataBuilder.CreateMemberExpense(1, id, FrequencyIds.Month, monthlyExpense); var memberSalary = MemberDataBuilder.CreateMemberSalary(1, id, FrequencyIds.Month, monthlySalary); var member = MemberDataBuilder.CreateMember(id, memberAccounts, memberExpense, memberSalary, name, emailAddress); // act var memberModel = _mapper.Map <MemberModel>(member); // assert memberModel.ShouldSatisfyAllConditions( () => memberModel.ShouldNotBeNull(), () => memberModel.Name.ShouldBe(member.Name), () => memberModel.Email.ShouldBe(member.Email), () => memberModel.Id.ShouldBe(member.Id), () => memberModel.MonthlySalary.ShouldBe(member.MemberSalary.GetMonthlySalary()), () => memberModel.MonthlyExpense.ShouldBe(member.MemberExpense.GetMonthlyExpense()) ); }
public void GivenMemberEntity_WhenCallGetMonthNetIncome_ShouldReturnValue() { // assign var memberId = 1; var memberExpensive = MemberDataBuilder.CreateMemberExpense(1, memberId, FrequencyIds.Month, 2000); var memberSalary = MemberDataBuilder.CreateMemberSalary(1, memberId, FrequencyIds.Month, 5000); var member = MemberDataBuilder.CreateMember(1, new List <MemberAccount>(), memberExpensive, memberSalary); // act var result = member.GetMonthNetIncome(); // assert result.ShouldBe(3000); }
public void GivenMonthNetIncomeGuard_WhenCallCanSignUp_ShouldReturnResult(decimal monthlySalary, decimal monthlyExpense, decimal monthNetIncomeLimit, bool canSignUp) { // assign var memberId = 1; var memberExpensive = MemberDataBuilder.CreateMemberExpense(1, memberId, FrequencyIds.Month, monthlyExpense); var memberSalary = MemberDataBuilder.CreateMemberSalary(1, memberId, FrequencyIds.Month, monthlySalary); var member = MemberDataBuilder.CreateMember(1, new List <MemberAccount>(), memberExpensive, memberSalary); var strategy = AccountSignUpStrategyDataBuilder.CreateAccountSignUpStrategy(1, true, monthNetIncomeLimit); // act var result = _accountSignUpGuard.CanSignUp(member, strategy); // assert result.IsSuccess.ShouldBe(canSignUp); }