Exemple #1
0
 /// <summary>
 /// Adds a timeregistration.
 /// </summary>
 /// <param name="timeRegistration">The time registration.</param>
 private void AddTimeRegistration(TimeRegistration timeRegistration)
 {
     if (!timeRegistrations.Contains(timeRegistration))
     {
         timeRegistrations.Add(timeRegistration);
     }
     timeRegistration.Task = this;
 }
Exemple #2
0
        /// <summary>
        /// Register time spent on this task.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="date">The date.</param>
        /// <param name="sprint">De sprint.</param>
        /// <param name="time">The time.</param>
        public virtual void RegisterTime(User user, DateTime date, Sprint sprint, TimeSpan time)
        {
            if (!story.Project.Sprints.Contains(sprint))
            {
                throw new ArgumentException("The given sprint does not belong to this project.", "sprint");
            }

            foreach (TimeRegistration registratie in GetTimeRegistrationsFor(user, sprint, date))
            {
                RemoveTimeRegistration(registratie);
            }

            //only add timeregistrations that actually contain time
            if (time.TotalSeconds == 0)
                return;

            TimeRegistration timeRegistration = new TimeRegistration(user, date, sprint, this, time);
            AddTimeRegistration(timeRegistration);
        }
Exemple #3
0
 /// <summary>
 /// Removes a timeregistration.
 /// </summary>
 /// <param name="timeRegistration">The time registration.</param>
 public virtual void RemoveTimeRegistration(TimeRegistration timeRegistration)
 {
     if (timeRegistrations.Contains(timeRegistration))
     {
         timeRegistrations.Remove(timeRegistration);
     }
 }
 public void TestTijdRegistratieHandmatigToevoegenMagNiet()
 {
     TimeRegistration tijdRegistratie = new TimeRegistration(gebruiker, DateTime.Now, sprint, task, tijd);
     task.TimeRegistrations.Add(tijdRegistratie);
     Assert.Fail();
 }