public void ListItem_ListBugsStatusAssigneeSorted()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");
            var member  = new FakeMember("Member10");

            bug.AddAssignee(member);
            var bug2 = new FakeBug("11");

            bug.AddAssignee(member);
            bug2.AddAssignee(member);
            database.AddMemberToDB(member);
            database.AddWorkItemToDB(bug);
            database.AddWorkItemToDB(bug2);
            bug.Title  = "Title for Bug.";
            bug2.Title = "Bug title";
            var allBugs = database.GetAllWorkItems().OfType <FakeBug>()
                          .Where(b => (b.Status.ToString().Equals("active", StringComparison.OrdinalIgnoreCase)) &&
                                 (b.Assignee != null && b.Assignee.Name.Equals("Member10", StringComparison.OrdinalIgnoreCase))).ToList()
                          .OrderBy(b => b.Title).ToList();
            var result = new ListWorkItemsCommand(new List <string>()
            {
                "bug", "active", "Member10", "title"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allBugs), result);
        }
        public void ListItem_ListStories()
        {
            var factory    = new Mock <IFactory>();
            var allStories = database.GetAllWorkItems().OfType <FakeStory>();
            var result     = new ListWorkItemsCommand(new List <string>()
            {
                "story"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allStories), result);
        }
        public void ListItem_ListBugsStatusActive()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");

            database.AddWorkItemToDB(bug);
            var allBugs = database.GetAllWorkItems().OfType <FakeBug>().Where(b => b.Status.ToString().Equals("active", StringComparison.OrdinalIgnoreCase)).ToList();
            var result  = new ListWorkItemsCommand(new List <string>()
            {
                "bug", "active"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allBugs), result);
        }
        public void ListItem_ListBugs()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");

            database.AddWorkItemToDB(bug);
            var allBugs = database.GetAllWorkItems().OfType <FakeBug>();
            var result  = new ListWorkItemsCommand(new List <string>()
            {
                "bug"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allBugs), result);
        }
        public void ListItem_ListBugsAssignee()
        {
            var factory = new Mock <IFactory>();
            var bug     = new FakeBug("10");
            var member  = new FakeMember("Member10");

            bug.AddAssignee(member);
            database.AddMemberToDB(member);
            database.AddWorkItemToDB(bug);
            var allBugs = database.GetAllWorkItems().OfType <FakeBug>()
                          .Where(b => b.Assignee != null && b.Assignee.Name.Equals("Member10", StringComparison.OrdinalIgnoreCase)).ToList();
            var result = new ListWorkItemsCommand(new List <string>()
            {
                "bug", "Member10"
            }, database, factory.Object).Execute();

            Assert.AreEqual(string.Join("\n", allBugs), result);
        }