public void AdministratorsControllerGetAllTest() { var FirstAdministrator = new Administrator { Id = Guid.NewGuid(), Name = "First Admin", Email = "*****@*****.**", Password = "******" }; var SecondAdministrator = new Administrator { Id = Guid.NewGuid(), Name = "Second Admin", Email = "*****@*****.**", Password = "******" }; var Logic = CreateLogic(); var Controller = new AdministratorsController(Logic); Logic.Create(FirstAdministrator); Logic.Create(SecondAdministrator); List <Administrator> Administrators = new List <Administrator>() { FirstAdministrator, SecondAdministrator }; var Result = Controller.Get(); var CreatedResult = Result as OkObjectResult; var AdminResults = CreatedResult.Value as IEnumerable <AdministratorDTO>; Assert.AreEqual(Administrators.Count, AdminResults.ToList().Count); }
public void AdministratorsControllerGetTest() { var Admin = new Administrator { Id = Guid.NewGuid(), Name = "First Admin", Email = "*****@*****.**", Password = "******" }; var Logic = CreateLogic(); var Controller = new AdministratorsController(Logic); Logic.Create(Admin); var Result = Controller.Get(Admin.Id); var CreatedResult = Result as OkObjectResult; var Model = CreatedResult.Value as AdministratorDTO; Assert.AreEqual(Admin.Name, Model.Name); }