Exemplo n.º 1
0
        public Admin GetAdminInfo(int adminId)
        {
            var errors = new List<string>();
            var repository = new AdminRepository(this.entities);
            var service = new AdminService(repository);
            var adminPoco = service.GetAdminById(adminId, ref errors);

            if (errors.Count == 0 && adminPoco != null)
            {
                return adminPoco;
            }

            return new Admin();
        }
Exemplo n.º 2
0
        public void GetAdminErrorTest3()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<IAdminRepository>();
            var adminService = new AdminService(mockRepository.Object);
            var adminPoco = new Admin()
            {
                FirstName = "hi",
                LastName = string.Empty
            };

            //// Act
            adminService.GetAdminById(0, ref errors);

            //// Assert instructor object not null
            Assert.AreEqual(1, errors.Count);
        }