コード例 #1
0
        public void GetSprints_returns_only_open_sprints_when_request_is_default([Frozen, InMemory] IEntityData query,
                                                                                 [Frozen, HardCodedSpec] ISpecForSprintInProject sprintSpec,
                                                                                 [Frozen] ISpecForOpenSprint openSprintSpec,
                                                                                 [Frozen, HardCodedSpec] ISpecForClosedSprint closedSprintSpec,
                                                                                 SprintLister sut,
                                                                                 [HasIdentity] Sprint sprintOne,
                                                                                 [HasIdentity] Sprint sprintTwo,
                                                                                 [HasIdentity] Sprint sprintThree)
        {
            // Arrange
            sprintOne.Closed   = false;
            sprintTwo.Closed   = true;
            sprintThree.Closed = false;
            query.Add(sprintOne);
            query.Add(sprintTwo);
            query.Add(sprintThree);

            var expected = new[] { sprintOne, sprintThree };

            Mock.Get(openSprintSpec).Setup(x => x.GetExpression()).Returns(x => !x.Closed);

            // Act
            var result = sut.GetSprints(new ListSprintsRequest());

            // Assert
            Assert.That(result, Is.EquivalentTo(expected));
        }
コード例 #2
0
        public void GetSprints_orders_sprints_by_start_dates_when_present([Frozen, InMemory] IEntityData query,
                                                                          [Frozen, HardCodedSpec] ISpecForSprintInProject sprintSpec,
                                                                          [Frozen, HardCodedSpec] ISpecForOpenSprint openSprintSpec,
                                                                          [Frozen, HardCodedSpec] ISpecForClosedSprint closedSprintSpec,
                                                                          SprintLister sut,
                                                                          [HasIdentity] Sprint sprintOne,
                                                                          [HasIdentity] Sprint sprintTwo,
                                                                          [HasIdentity] Sprint sprintThree)
        {
            // Arrange
            sprintOne.StartDate   = new DateTime(2011, 1, 1);
            sprintTwo.StartDate   = new DateTime(2010, 1, 1);
            sprintThree.StartDate = new DateTime(2012, 1, 1);
            query.Add(sprintOne);
            query.Add(sprintTwo);
            query.Add(sprintThree);

            var expected = new[] { sprintTwo, sprintOne, sprintThree };

            var request = new ListSprintsRequest {
                ShowOpenSprints   = true,
                ShowClosedSprints = true,
            };

            // Act
            var result = sut.GetSprints(request);

            // Assert
            Assert.That(result, Is.EqualTo(expected));
        }