public void ShouldSaveAndLoadTaxStatement() { IRepository repository = new Repository(); var password = new Password { PasswordString = "abc" }; var email = new EmailAddress("*****@*****.**"); var taxPayer= new User(email, password); taxPayer.FromMetro = true; taxPayer.RentPaid = 8000.00; AnnualSalary salary = new AnnualSalary() { Basic = 10000, Epf = 2000, Hra = 6000, Id = "salary", ProfessionalTax = 200, SpecialAllowance = 5000, TaxDedeuctedAtSource = 5000}; TaxStatement taxStatement = new TaxStatement(salary, taxPayer); DonationsUnder80G donationsUnder80G = new DonationsUnder80G(); var halfExemptDonation = new HalfExemptDonation(20000); donationsUnder80G.AddDonation(halfExemptDonation); var fullyExemptDonation = new FullyExemptDonation(10000); donationsUnder80G.AddDonation(fullyExemptDonation); taxStatement.DonationsUnder80G = donationsUnder80G; repository.Save(taxStatement); List<TaxStatement> taxStatements = repository.LoadAll<TaxStatement>(); var loadedTaxStatement = taxStatements.FirstOrDefault(stmt => stmt.Id == taxStatement.Id); Assert.IsNotNull(loadedTaxStatement); Assert.IsNotNull(loadedTaxStatement.TaxPayer); Assert.IsTrue(taxStatement.GetDonationsUnder80G().Contains(halfExemptDonation)); Assert.IsTrue(taxStatement.GetDonationsUnder80G().Contains(fullyExemptDonation)); }
public bool Equals(EmailAddress other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.value, value); }
public void MustHaveAValue() { EmailAddress email = new EmailAddress("*****@*****.**"); Assert.AreEqual("*****@*****.**", email.ToString()); }
public void ShouldSaveAndLoadUser() { IRepository repository = new Repository(); var password = new Password { PasswordString = "abc" }; var email = new EmailAddress("*****@*****.**"); var user = new User(email, password); user.FromMetro = true; user.RentPaid = 8000.00; user.Repository = repository; user.Register(); User actualUser = repository.LoadByEmailId(email); Assert.IsNotNull(actualUser); Assert.AreEqual(email, actualUser.EmailAddress); Assert.AreEqual(user.FromMetro, actualUser.FromMetro); Assert.AreEqual(user.RentPaid, actualUser.RentPaid); }