Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using TaskManegementSystemCore;
- using TaskManegementSystemOperations;
- using TaskManegementSystemOperations.Commands;
- namespace Operations_Tests
- {
- [TestClass]
- public class Show_All_People_Test
- {
- [TestMethod]
- public void ConstructurShouldCallBaseClass()
- {
- Repository repository = new Repository();
- Show_All_People command = new Show_All_People(repository);
- Assert.AreEqual(repository, command.Repository);
- }
- [TestMethod]
- public void ExecuteShouldCallMethod()
- {
- Repository repository = new Repository();
- Show_All_People command = new Show_All_People(repository);
- Create_Person person1 = new Create_Person(repository);
- person1.Repository.CreatePerson("peshko");
- Assert.AreEqual(command.ShowAllPeople(), command.Execute());
- }
- [TestMethod]
- public void ShowAllPeopleShouldThrowWhenNoPeople()
- {
- Repository repository = new Repository();
- Show_All_People command = new Show_All_People(repository);
- Assert.ThrowsException<ArgumentException>(() => command.ShowAllPeople());
- }
- [TestMethod]
- public void ShowAllPeopleShouldReturnAllPeople()
- {
- Repository repository = new Repository();
- Show_All_People command = new Show_All_People(repository);
- Create_Person person1 = new Create_Person(repository);
- person1.Repository.CreatePerson("peshko");
- person1.Repository.CreatePerson("sashko");
- string expected = $"1. peshko\r\n2. sashko"; // \r\n is enviroment new line
- string current = command.ShowAllPeople();
- Assert.AreEqual(expected, current);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement