public void ShowAllMembers_ShowAllMembers() { var factory = new Mock <IFactory>(); var result = new ShowAllMembersCommand(new List <string>(), database, factory.Object).Execute(); Assert.AreEqual(result, string.Join(", ", database.GetAllMembers().Select(b => b.Name))); }
public void ShowAllMembers_NoMembersExist() { var factory = new Mock <IFactory>(); database.AllMembers.Clear(); var result = new ShowAllMembersCommand(new List <string>(), database, factory.Object).Execute(); Assert.AreEqual("There are no members.", result); }
public void ShowAllMembersCommandPrint() { string memberName = "RATAI"; IMember member = new Member(memberName); database.Members.Add(member); List <string> parameters = new List <string>(); ShowAllMembersCommand command = new ShowAllMembersCommand(parameters); var sb = new StringBuilder(); sb.AppendLine("***All People***"); foreach (var item in this.database.Members) { sb.AppendLine(item.PrintDetails()); } string expected = sb.ToString(); string actual = command.Execute(); Assert.AreEqual(expected, actual); }