public void SeedData() { var member1 = new FakeMember("Member1"); var member2 = new FakeMember("Member2"); var member3 = new FakeMember("Member3"); var team1 = new FakeTeam("Team1"); var team2 = new FakeTeam("Team2"); var board1 = new FakeBoard("Board1"); var board2 = new FakeBoard("Board2"); var board3 = new FakeBoard("Board3"); var feedback = new FakeFeedback("1"); var story = new FakeStory("2"); database.AddTeamToDB(team1); database.AddTeamToDB(team2); database.AddMemberToDB(member1); database.AddMemberToDB(member2); database.AddMemberToDB(member3); database.AddWorkItemToDB(feedback); database.AddWorkItemToDB(story); team2.AddMember(member1); team1.AddBoard(board1); team2.AddBoard(board2); team2.AddBoard(board3); board1.AddWorkItem(feedback); board2.AddWorkItem(story); member1.AddWorkItems(story); member1.AddWorkItems(feedback); }
public void WorkItem_Added() { var board = new Board("Board1"); var feedback = new FakeFeedback(); board.AddWorkItem(feedback); Assert.IsTrue(board.WorkItems.Contains(feedback)); }
public void AddWorkItems_Should_AddSuccessfully() { var feedback = new FakeFeedback(); var member = new Member("Bruce"); member.AddWorkItems(feedback); Assert.IsTrue(member.WorkItems.Contains(feedback)); }
public void Should_AddWorkItem() { var db = Database.Instance; var feedback = new FakeFeedback(); db.AddWorkItemToDB(feedback); Assert.IsTrue(db.AllWorkItems.Contains(feedback)); }
public void RemoveWorkItemsShould_RemovedItem() { var feedback = new FakeFeedback(); var member = new Member("Bruce"); member.AddWorkItems(feedback); member.RemoveWorkItems(feedback); Assert.AreEqual(member.WorkItems.Count, 0); }
public void History_Added() { var board = new Board("Board1"); var feedback = new FakeFeedback(); board.AddWorkItem(feedback); Assert.AreEqual("Item added.", string.Join("", board.ActivityHistory)); }
public void Setup() { scriptStore = new FakeScriptStore(); schemaHistory = new FakeSchemaHistory(); database = new FakeDatabase(); clock = new AutoIncrementClock(now); feedback = new FakeFeedback(); rollbacker = new RollbackExecutor(scriptStore, schemaHistory, database, clock, feedback); }
public void ReturnsWorkItem() { var db = Database.Instance; var feedback = new FakeFeedback(); feedback.Id = "1"; db.AddWorkItemToDB(feedback); var workItem = db.GetWorkItem("1"); Assert.AreEqual(feedback, workItem); }
public void ThrowWhen_MemberDoesNotHaveWorkItem() { var validator = new Validator(database); var member = new FakeMember("Member1"); var workItem = new FakeFeedback(); workItem.Id = "1"; var result = Assert.ThrowsException <ArgumentException>(() => validator.MemberHasWorkItem(workItem, member)); Assert.AreEqual("Member: 'Member1' does not have access to work item: '1'.", result.Message); }
public void ThrowsWhen_IsFeedback() { var db = Database.Instance; var feedback = new FakeFeedback(); feedback.Id = "1"; db.AddWorkItemToDB(feedback); var result = Assert.ThrowsException <ArgumentException>(() => db.GetWorkItemToAssign("1")); Assert.AreEqual("Feedback doesn't have an assignee.", result.Message); }
public void ChangeFeedback_ThrowWhen_PropertyWrong() { var factory = new Mock <IFactory>(); IFeedback feedback = new FakeFeedback("1"); database.AddWorkItemToDB(feedback); var result = Assert.ThrowsException <ArgumentException>(() => new ChangeFeedbackCommand(new List <string>() { "1", "wrong", "aaa" }, database, factory.Object).Execute()); Assert.AreEqual("Property type is not valid.", result.Message); }
public void ChangeFeedback_ThrowWhen_RatingNotNumber() { var factory = new Mock <IFactory>(); IFeedback feedback = new FakeFeedback("1"); database.AddWorkItemToDB(feedback); var result = Assert.ThrowsException <ArgumentException>(() => new ChangeFeedbackCommand(new List <string>() { "1", "rating", "bigrating" }, database, factory.Object).Execute()); Assert.AreEqual("Rating should be a number.", result.Message); }
public void ShowTeamActivity_ShowMemberAndBoardActivity() { var factory = new Mock <IFactory>(); StringBuilder sb = new StringBuilder(); var team = new FakeTeam("Team5"); database.AddTeamToDB(team); var board = new FakeBoard(); team.AddBoard(board); var f1 = new FakeFeedback("5"); board.AddWorkItem(f1); var f2 = new FakeFeedback("6"); board.AddWorkItem(f2); var member = new FakeMember("Member5"); database.AddMemberToDB(member); team.AddMember(member); var f3 = new FakeFeedback("7"); member.AddWorkItems(f3); sb.AppendLine($"Team: 'Team5' - Boards activity: "); var activityTeam = team.Boards.SelectMany(b => b.ActivityHistory).ToList(); sb.AppendLine(string.Join("; ", activityTeam)); sb.AppendLine($"Team: 'Team5' - Members activity: "); var activityMembers = team.Members.SelectMany(m => m.ActivityHistory).ToList(); sb.AppendLine(string.Join("; ", activityMembers)); var result = new ShowTeamActivityCommand(new List <string>() { "Team5" }, database, factory.Object).Execute(); Assert.AreEqual(sb.ToString(), result); }