public virtual void RemoveUsage(HourUsage hourUsage) { if (hourUsage != null) { Usages.Remove(hourUsage); } }
public virtual void AddUsage(HourUsage hourUsage) { if (hourUsage != null) { Usages.Add(hourUsage); } }
public virtual void AddUsage(HourUsage usage) { if (!Usages.Contains(usage)) { usage.Week = this; Usages.Add(usage); } }
public void ShouldSetWeekToSelfWhenAddingUsage() { var week = new Week(); var usage = new HourUsage(); week.AddUsage(usage); Assert.That(week.Usages.Count, Is.EqualTo(1)); Assert.That(usage.Week, Is.EqualTo(week)); }
public virtual void RemoveUsage(HourUsage usage) { if (Usages.Contains(usage)) { Usages.Remove(usage); usage.Week = null; } }
public void Should() { var hourCode = new HourCode(); var hourUsage = new HourUsage(); hourUsage.SetHourCode(hourCode); Assert.That(hourUsage.HourCode, Is.EqualTo(hourCode)); Assert.That(hourCode.Usages, Contains.Item(hourUsage)); }
private void AddUsage(object parameter) { var usage = new HourUsage(); Week.AddUsage(usage); Usages.Add(new HourUsageViewModel(_hourCodeProvider, this, usage)); }