public void NoSpecialCircumStances_ShouldCalculateto10000() { //Arrange ITotalAssetCalculation standardGrossAssetCalculation = new TotalAssetCalculationStandard(); var mockAssetRepository = new Mock <IAssetRepository>(); Mock <tcFamily> stubFamily = new Mock <tcFamily>(); mockAssetRepository .Setup(repo => repo.GetAssetsByFamily(It.IsAny <int>())) .Returns(() => new List <tcAsset>() { new tcAsset { Value = 10000, IsActive = true, tcFamilyMember = new tcFamilyMember { tcFamilyMemberStatu = new tcFamilyMemberStatu { FamilyMemberStatus = "Head" }, IsActive = true }, AnnualIncome = 0, WithdrawlPenalty = 0 } }); //Act decimal totalAssetAmount = standardGrossAssetCalculation.CalculateTotalAssetAmount( stubFamily.Object, mockAssetRepository.Object); //Assert Assert.IsTrue(totalAssetAmount == 10000); }
public void WithdrawlPenalty_ShouldCalculateto9000() { //Arrange is happening in the initialize method... ITotalAssetCalculation standardGrossAssetCalculation = new TotalAssetCalculationStandard(); var mockAssetRepository = new Mock <IAssetRepository>(); var mockSettingsRepository = new Mock <ISettingsRepository>(); Mock <tcFamily> stubFamily = new Mock <tcFamily>(); mockSettingsRepository .Setup(repo => repo.GetHUDPassbookRate()) .Returns(() => .05m); mockAssetRepository .Setup(repo => repo.GetAssetsByFamily(It.IsAny <int>())) .Returns(() => new List <tcAsset>() { new tcAsset { Value = 10000, IsActive = true, tcFamilyMember = new tcFamilyMember { tcFamilyMemberStatu = new tcFamilyMemberStatu { FamilyMemberStatus = "Head" }, IsActive = true }, AnnualIncome = 0, WithdrawlPenalty = 1000 } }); //Act decimal totalAssetAmount = standardGrossAssetCalculation.CalculateTotalAssetAmount(stubFamily.Object, mockAssetRepository.Object); //Assert Assert.IsTrue(totalAssetAmount == 9000m); }