public void Execute_Success() { //Arrange Commons.currentTeam = new Team("TeamName"); Commons.currentBoard = new Board("BoardName"); Commons.currentTeam.Boards.Add(Commons.currentBoard); var fakeMember = new Member("TestMemberName"); var fakeCurrTeam = Commons.currentTeam; var fakeCurrBoard = Commons.currentBoard; fakeCurrTeam.Members.Add(fakeMember); var listParams = new List <string>() { "TestMemberName", "WorkItemTitle" }; var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical); fakeCurrBoard.WorkItems.Add(workItem); var sut = new AssignCommand(listParams); //Act var result = sut.Execute(); //Assert Assert.AreEqual(result, "TestMemberName has been assigned to WorkItemTitle"); }
public void Execute_NonAssigneeType_ThrowEx() { //Arrange Commons.currentTeam = new Team("TeamName"); Commons.currentBoard = new Board("BoardName"); Commons.currentTeam.Boards.Add(Commons.currentBoard); var fakeMember = new Member("TestMemberName"); var fakeCurrTeam = Commons.currentTeam; var fakeCurrBoard = Commons.currentBoard; fakeCurrTeam.Members.Add(fakeMember); var listParams = new List <string>() { "TestMemberName", "WorkItemTitle" }; var workItem = new Feedback("WorkItemTitle", "WorkItemDescription", 3); fakeCurrBoard.WorkItems.Add(workItem); var sut = new AssignCommand(listParams); //Act & Assert Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Work item WorkItemTitle is of type feedback and it is not supposed to have assignee."); }
public void AssignCommand_AssignMemberToWorkItem() { var factory = new Mock <IFactory>(); var command = new AssignCommand(new List <string>() { "Member1", "2" }, database, factory.Object); Assert.AreEqual("Work item: '2' assigned to 'Member1'.", command.Execute()); }
public void Execute_Less_Params_ThrowEx() { //Arrange var listParams = new List <string>() { "TeamMemberName" }; var sut = new AssignCommand(listParams); //Act & Assert Assert.ThrowsException <ArgumentException>(() => sut.Execute(), "Parameters count is not valid!"); }
public void Execute_NonExistingWorkItem_ThrowEx() { //Arrange Commons.currentTeam = new Team("TeamName"); Commons.currentBoard = new Board("BoardName"); Commons.currentTeam.Boards.Add(Commons.currentBoard); var fakeCurrTeam = Commons.currentTeam; var fakeCurrBoard = Commons.currentBoard; var listParams = new List <string>() { "TestMemberName", "WorkItemTitle" }; var sut = new AssignCommand(listParams); //Act & Assert Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Work item with title WorkItemTitle does not exist in board {fakeCurrBoard.Name}."); }
public void Execute_NonExistingMember_ThrowEx() { //Arrange Commons.currentTeam = new Team("TeamName"); Commons.currentBoard = new Board("BoardName"); Commons.currentTeam.Boards.Add(Commons.currentBoard); var fakeCurrTeam = Commons.currentTeam; var fakeCurrBoard = Commons.currentBoard; var listParams = new List <string>() { "TestMemberName", "WorkItemTitle" }; var workItem = new Bug("WorkItemTitle", "WorkItemDescription", Priority.High, Severity.Critical); fakeCurrBoard.WorkItems.Add(workItem); var sut = new AssignCommand(listParams); //Act & Assert Assert.ThrowsException <ArgumentException>(() => sut.Execute(), $"Member with name TestMemberName does not exist in team {fakeCurrTeam.Name}."); }