Exemple #1
0
 /// <summary>
 /// A read-only collection of Effort Records that belong to this iteration
 /// </summary>
 public ICollection <Effort> GetEffortRecords(EffortFilter filter)
 {
     filter = filter ?? new EffortFilter();
     filter.Iteration.Clear();
     filter.Iteration.Add(this);
     return(Instance.Get.EffortRecords(filter));
 }
Exemple #2
0
        public void ValueRange()
        {
            var story = EntityFactory.CreateStory("Story1", SandboxProject);
            var task  = EntityFactory.CreateTask("Task 1", story);

            var effort1 = task.CreateEffort(1);
            var effort2 = task.CreateEffort(2);
            var effort3 = task.CreateEffort(3);

            ResetInstance();

            var filter = new EffortFilter();

            filter.Workitem.Add(task);
            filter.Value.Range(0.5, 3.5);
            var efforts = Instance.Get.EffortRecords(filter);

            Assert.AreEqual(3, efforts.Count);
            CollectionAssert.Contains(efforts, effort1);
            CollectionAssert.Contains(efforts, effort2);
            CollectionAssert.Contains(efforts, effort3);

            filter.Value.Clear();
            filter.Value.Range(1.5, 3.5);
            efforts = Instance.Get.EffortRecords(filter);
            Assert.AreEqual(2, efforts.Count);
            CollectionAssert.DoesNotContain(efforts, effort1);
            CollectionAssert.Contains(efforts, effort2);
            CollectionAssert.Contains(efforts, effort3);

            filter.Value.Range(3.5, 4.5);
            efforts = Instance.Get.EffortRecords(filter);
            Assert.AreEqual(0, efforts.Count);
        }
		/// <summary>
		/// Effort Records that belong to this Team
		/// </summary>
		public ICollection<Effort> GetEffortRecords(EffortFilter filter)
		{
			filter = filter ?? new EffortFilter();
			filter.Team.Clear();
			filter.Team.Add(this);
			return Instance.Get.EffortRecords(filter);
		}
 /// <summary>
 /// A collection of Effort records that belong to this project
 /// </summary>
 /// <param name="filter">Criteria to filter on. Project will be set automatically. If null, all effort records in the project are returned.</param>
 /// <param name="includeSubprojects">Specifies whether to include items from sub project or not. This only adds open subprojects.</param>
 public ICollection <Effort> GetEffortRecords(EffortFilter filter, bool includeSubprojects)
 {
     filter = filter ?? new EffortFilter();
     filter.Project.Clear();
     if (includeSubprojects)
     {
         foreach (var p in GetThisAndAllChildProjects())
         {
             filter.Project.Add(p);
         }
     }
     else
     {
         filter.Project.Add(this);
     }
     return(Instance.Get.EffortRecords(filter));
 }
Exemple #5
0
        public void Date()
        {
            var story = EntityFactory.CreateStory("Story1", SandboxProject);
            var task  = EntityFactory.CreateTask("Task 1", story);

            var effort1     = task.CreateEffort(1d);
            var effort1Date = effort1.Date;
            var effort2Date = effort1Date.AddDays(1);
            var effort2     = task.CreateEffort(2d);

            effort2.Date = effort2Date;
            effort2.Save();
            ResetInstance();

            var filter = new EffortFilter();

            filter.Workitem.Add(task);
            filter.Date.AddTerm(FilterTerm.Operator.GreaterThan, effort1Date);
            var efforts = Instance.Get.EffortRecords(filter);

            CollectionAssert.DoesNotContain(efforts, effort1);
            CollectionAssert.Contains(efforts, effort2);

            filter.Date.Clear();
            filter.Date.AddTerm(FilterTerm.Operator.LessThan, effort2Date);
            efforts = Instance.Get.EffortRecords(filter);
            CollectionAssert.Contains(efforts, effort1);
            CollectionAssert.DoesNotContain(efforts, effort2);

            filter.Date.Clear();
            filter.Date.AddTerm(FilterTerm.Operator.LessThanOrEqual, effort1Date);
            efforts = Instance.Get.EffortRecords(filter);
            CollectionAssert.Contains(efforts, effort1);
            CollectionAssert.DoesNotContain(efforts, effort2);

            filter.Date.Clear();
            filter.Date.AddTerm(FilterTerm.Operator.GreaterThanOrEqual, effort2Date);
            efforts = Instance.Get.EffortRecords(filter);
            CollectionAssert.DoesNotContain(efforts, effort1);
            CollectionAssert.Contains(efforts, effort2);
        }
Exemple #6
0
        public void Value()
        {
            var story = EntityFactory.CreateStory("Story1", SandboxProject);
            var task  = EntityFactory.CreateTask("Task 1", story);

            var effort1 = task.CreateEffort(1);
            var effort2 = task.CreateEffort(2);
            var effort3 = task.CreateEffort(3);

            ResetInstance();

            var filter = new EffortFilter();

            filter.Workitem.Add(task);
            filter.Value.AddTerm(FilterTerm.Operator.Equal, 2);
            var efforts = Instance.Get.EffortRecords(filter);

            Assert.AreEqual(1, efforts.Count);
            CollectionAssert.DoesNotContain(efforts, effort1);
            CollectionAssert.DoesNotContain(efforts, effort3);
            CollectionAssert.Contains(efforts, effort2);

            filter.Value.Clear();
            filter.Value.AddTerm(FilterTerm.Operator.LessThan, 2.5);
            efforts = Instance.Get.EffortRecords(filter);
            Assert.AreEqual(2, efforts.Count);
            CollectionAssert.Contains(efforts, effort1);
            CollectionAssert.Contains(efforts, effort2);
            CollectionAssert.DoesNotContain(efforts, effort3);

            filter.Value.Clear();
            filter.Value.AddTerm(FilterTerm.Operator.GreaterThan, 2.5);
            efforts = Instance.Get.EffortRecords(filter);
            Assert.AreEqual(1, efforts.Count);
            CollectionAssert.Contains(efforts, effort3);
            CollectionAssert.DoesNotContain(efforts, effort1);
            CollectionAssert.DoesNotContain(efforts, effort2);
        }
		public void Date()
		{
			var story = EntityFactory.CreateStory("Story1", SandboxProject);
			var task = EntityFactory.CreateTask("Task 1", story);

			var effort1 = task.CreateEffort(1d);
			var effort1Date = effort1.Date;
			var effort2Date = effort1Date.AddDays(1);
			var effort2 = task.CreateEffort(2d);
			effort2.Date = effort2Date;
			effort2.Save();
			ResetInstance();

			var filter = new EffortFilter();
			filter.Workitem.Add(task);
			filter.Date.AddTerm(FilterTerm.Operator.GreaterThan, effort1Date);
			var efforts = Instance.Get.EffortRecords(filter);
			CollectionAssert.DoesNotContain(efforts, effort1);
			CollectionAssert.Contains(efforts, effort2);

			filter.Date.Clear();
			filter.Date.AddTerm(FilterTerm.Operator.LessThan, effort2Date);
			efforts = Instance.Get.EffortRecords(filter);
			CollectionAssert.Contains(efforts, effort1);
			CollectionAssert.DoesNotContain(efforts, effort2);

			filter.Date.Clear();
			filter.Date.AddTerm(FilterTerm.Operator.LessThanOrEqual, effort1Date);
			efforts = Instance.Get.EffortRecords(filter);
			CollectionAssert.Contains(efforts, effort1);
			CollectionAssert.DoesNotContain(efforts, effort2);

			filter.Date.Clear();
			filter.Date.AddTerm(FilterTerm.Operator.GreaterThanOrEqual, effort2Date);
			efforts = Instance.Get.EffortRecords(filter);
			CollectionAssert.DoesNotContain(efforts, effort1);
			CollectionAssert.Contains(efforts, effort2);
		}
		public void Value()
		{
			var story = EntityFactory.CreateStory("Story1", SandboxProject);
			var task = EntityFactory.CreateTask("Task 1", story);

			var effort1 = task.CreateEffort(1);
			var effort2 = task.CreateEffort(2);
			var effort3 = task.CreateEffort(3);

			ResetInstance();

			var filter = new EffortFilter();
			filter.Workitem.Add(task);
			filter.Value.AddTerm(FilterTerm.Operator.Equal, 2);
			var efforts = Instance.Get.EffortRecords(filter);
			Assert.AreEqual(1, efforts.Count);
			CollectionAssert.DoesNotContain(efforts, effort1);
			CollectionAssert.DoesNotContain(efforts, effort3);
			CollectionAssert.Contains(efforts, effort2);

			filter.Value.Clear();
			filter.Value.AddTerm(FilterTerm.Operator.LessThan, 2.5);
			efforts = Instance.Get.EffortRecords(filter);
			Assert.AreEqual(2, efforts.Count);
			CollectionAssert.Contains(efforts, effort1);
			CollectionAssert.Contains(efforts, effort2);
			CollectionAssert.DoesNotContain(efforts, effort3);

			filter.Value.Clear();
			filter.Value.AddTerm(FilterTerm.Operator.GreaterThan, 2.5);
			efforts = Instance.Get.EffortRecords(filter);
			Assert.AreEqual(1, efforts.Count);
			CollectionAssert.Contains(efforts, effort3);
			CollectionAssert.DoesNotContain(efforts, effort1);
			CollectionAssert.DoesNotContain(efforts, effort2);
		}
Exemple #9
0
 /// <summary>
 /// Get effort records filtered by the criteria specified in the passed in filter.
 /// </summary>
 /// <param name="filter">Limit the items returned. If null, then all items returned.</param>
 /// <returns>ICollection of items as specified in the filter.</returns>
 public ICollection <Effort> EffortRecords(EffortFilter filter)
 {
     return(Get <Effort>(filter ?? new EffortFilter()));
 }
Exemple #10
0
        public void ValueRangeInvalidBounds()
        {
            var filter = new EffortFilter();

            filter.Value.Range(10, 0);
        }
 /// <summary>
 /// A collection of Effort records that belong to this project
 /// </summary>
 /// <param name="filter">Criteria to filter on. Project will be set automatically. If null, all effort records in the project are returned.</param>
 public ICollection <Effort> GetEffortRecords(EffortFilter filter)
 {
     return(GetEffortRecords(filter, false));
 }
		public void ValueRange()
		{
			var story = EntityFactory.CreateStory("Story1", SandboxProject);
			var task = EntityFactory.CreateTask("Task 1", story);

			var effort1 = task.CreateEffort(1);
			var effort2 = task.CreateEffort(2);
			var effort3 = task.CreateEffort(3);

			ResetInstance();

			var filter = new EffortFilter();
			filter.Workitem.Add(task);
			filter.Value.Range(0.5, 3.5);
			var efforts = Instance.Get.EffortRecords(filter);
			Assert.AreEqual(3, efforts.Count);
			CollectionAssert.Contains(efforts, effort1);
			CollectionAssert.Contains(efforts, effort2);
			CollectionAssert.Contains(efforts, effort3);

			filter.Value.Clear();
			filter.Value.Range(1.5, 3.5);
			efforts = Instance.Get.EffortRecords(filter);
			Assert.AreEqual(2, efforts.Count);
			CollectionAssert.DoesNotContain(efforts, effort1);
			CollectionAssert.Contains(efforts, effort2);
			CollectionAssert.Contains(efforts, effort3);

			filter.Value.Range(3.5, 4.5);
			efforts = Instance.Get.EffortRecords(filter);
			Assert.AreEqual(0, efforts.Count);
		}
		public void ValueRangeInvalidBounds()
		{
			var filter = new EffortFilter();
			filter.Value.Range(10, 0);
		}