public void Execute_Less_Params_ThrowEx()
        {
            var fakeProvider = new FakeWorkItemProvider();
            var listParams   = new List <string>();
            var bug1         = new Bug("WindowsCrash", "Description", Priority.High, Severity.Critical);
            var bug2         = new Bug("CrashCrash", "NovDescription", Priority.Low, Severity.Minor);

            bug1.Status = StatusBug.Fixed;
            bug2.Status = StatusBug.Active;
            fakeProvider.Add(bug1);
            fakeProvider.Add(bug2);
            var sut = new FilterAllBugsByStatusCommand(listParams, fakeProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "Parameters count is not valid!");
        }
        public void FilterAllBugsByAssignee_Success()
        {
            //Arrange
            var member = new Member("TestMemberName");
            var fakeWorkItemProvider = new FakeWorkItemProvider();
            var fakeMemberProvider   = new FakeMemberProvider();

            fakeMemberProvider.Add(member);
            var bug = new Bug("TestBugTitle", "TestBugDescription", Priority.High, Severity.Critical);

            bug.Assignee = member;
            fakeWorkItemProvider.Add(bug);

            var list = new List <string>()
            {
                "TestMemberName"
            };
            var sut = new FilterAllBugsByAssigneeCommand(list, fakeWorkItemProvider, fakeMemberProvider);

            //Act
            var result = sut.Execute();

            //Assert
            Assert.IsTrue(result.IndexOf("TestMemberName") > 0);
        }
        public void ReturnCorrectString()
        {
            //Arrange
            var fakeProvider = new FakeWorkItemProvider();

            var storyA = new Story("TitleStoryA", "DescriptionStoryA", Priority.High, Size.Small);
            var storyB = new Story("TitleStoryB", "DescriptionStoryB", Priority.High, Size.Large);

            fakeProvider.Add(storyA);
            fakeProvider.Add(storyB);

            var list = new List <string>();
            var sut  = new SortStoriesBySizeCommand(list, fakeProvider);

            //Act
            var result = sut.Execute();

            //Assert
            Assert.IsTrue(result.StartsWith($"Story:{Environment.NewLine}  Title: TitleStoryB"));
        }
        public void ReturnCorrectString()
        {
            //Arrange
            var fakeProvider = new FakeWorkItemProvider();

            var listParams = new List <string>();
            //string title, string description, Priority priority, Severity severity
            var bug1 = new Bug("WindowsCrash", "Description", Priority.High, Severity.Critical);
            var bug2 = new Bug("CrashCrash", "NovDescription", Priority.Low, Severity.Minor);

            fakeProvider.Add(bug1);
            fakeProvider.Add(bug2);
            var sut = new SortBugsBySeverityCommand(listParams, fakeProvider);

            //Act
            var result = sut.Execute();

            //Assert
            Assert.IsTrue(result.StartsWith($"Bug:{Environment.NewLine}  Title: WindowsCrash"));
        }
Beispiel #5
0
        public void ReturnCorrectString()
        {
            //Arrange
            var fakeProvider = new FakeWorkItemProvider();
            var listParams   = new List <string>();

            var feedback1 = new Feedback("NewFeedback1", "Feed1Description", 5);
            var feedback2 = new Feedback("NewFeedback2", "Feed2Descriptin", 9);

            fakeProvider.Add(feedback1);
            fakeProvider.Add(feedback2);

            var sut = new SortAllItemsByRatingCommand(listParams, fakeProvider);

            //Act
            var result = sut.Execute();

            //Assert
            Assert.IsTrue(result.StartsWith($"Feedback:{Environment.NewLine}  Title: NewFeedback1"));
        }
        public void ReturnCorrectString()
        {
            //Arrange
            var fakeProvider = new FakeWorkItemProvider();
            var listParams   = new List <string>()
            {
                "fixed"
            };

            var bug1 = new Bug("WindowsCrash", "Description", Priority.High, Severity.Critical);
            var bug2 = new Bug("CrashCrash", "NovDescription", Priority.Low, Severity.Minor);

            bug1.Status = StatusBug.Fixed;
            bug2.Status = StatusBug.Active;
            fakeProvider.Add(bug1);
            fakeProvider.Add(bug2);
            var sut = new FilterAllBugsByStatusCommand(listParams, fakeProvider);

            //Act
            var result = sut.Execute();

            //Assert
            Assert.IsTrue(result.StartsWith($"Bug:{Environment.NewLine}  Title: WindowsCrash"));
        }
        public void FilterAllBugsByAssignee_Execute_MemberDoesNotExists_ThrowEx()
        {
            //Arrange
            var fakeWorkItemProvider = new FakeWorkItemProvider();
            var fakeMemberProvider   = new FakeMemberProvider();
            var bug = new Bug("TestBugTitle", "TestBugDescription", Priority.High, Severity.Critical);

            fakeWorkItemProvider.Add(bug);

            var list = new List <string>()
            {
                "TestMemberName"
            };
            var sut = new FilterAllBugsByAssigneeCommand(list, fakeWorkItemProvider, fakeMemberProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute());
        }
Beispiel #8
0
        public void BugCreation_Execute_SameTitleAlreadyExists_ThrowEx()
        {
            //Arrange
            CommonInstances.CreateTestInstances();
            var fakeProvider = new FakeWorkItemProvider();

            var fakeCurrBoard = Commons.currentBoard;

            var listParams = new List <string>()
            {
                "WorkItemTitle", "WorkItemDescription", "High", "Critical"
            };

            var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical);

            fakeProvider.Add(workItem);

            var sut = new CreateBugCommand(listParams, fakeProvider);

            //Act & Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "Bug already exists!");
        }