public Child CreateChild(string name, string userName, string password) { var child = new Child(name, userName, password, Id); var childProxy = new ChildProxy(child.Id, name); Children.Add(childProxy); return child; }
public void MakePaymentTo(Child child, decimal amount, string description) { if (!HasChild(child)) { throw new TardisBankException(ResourceMessages.FormatIsNotAChildOf, child.Name, Name); } child.ReceivePayment(amount, description); }
public void SetUp() { parent = new Parent("Mike Hadlow", "*****@*****.**", "pwd"); child = parent.CreateChild("Leo", "leohadlow", "xxx"); somebodyElse = new Parent("John Robinson", "*****@*****.**", "pwd"); somebodyElsesChild = somebodyElse.CreateChild("Jim", "jimrobinson", "yyy"); }
public void SetUp() { parent = new Parent("Dad", "*****@*****.**", "xxx"); child = parent.CreateChild("Leo", "leohadlow", "yyy"); parent.MakePaymentTo(child, 10.00M); somebodyElsesParent = new Parent("Not Dad", "*****@*****.**", "zzz"); // make sure these tests pass on non en-GB machines Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); DomainEvent.TurnOff(); }
public bool HasChild(Child child) { return Children.Any(x => x.ChildId == child.Id); }
public void MakePaymentTo(Child child, decimal amount) { MakePaymentTo(child, amount, string.Format(ResourceMessages.FormatPaymentFrom, Name)); }
public void SetUp() { child = new Parent("Mike", "*****@*****.**", "xxx").CreateChild("Leo", "leo2", "yyy"); }
public bool AreNullOrNotRelated(Parent parent, Child child) { if (parent == null || child == null) return true; if (!parent.HasChild(child)) { throw new TardisBankException("'{0}' is not a child of '{1}'", child.UserName, parent.UserName); } return false; }
public bool IsNotChildOfCurrentUser(Child child) { var parent = CurrentUser as Parent; return (child == null) || (parent == null) || (!parent.HasChild(child)); }
public void SetUp() { child = new Parent("Dad", "*****@*****.**", "xxx") .CreateChild("Leo", "leohadlow", "yyy"); }