Esempio n. 1
0
        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)));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }