Exemplo n.º 1
0
        public void AddForm_ReturnsCorrectView_True()
        {
            SpecialtyController controller  = new SpecialtyController();
            ActionResult        addFormView = controller.AddForm();

            Assert.IsInstanceOfType(addFormView, typeof(ViewResult));
        }
Exemplo n.º 2
0
        public void EditForm_HasCorrectModelType_Dictionary()
        {
            ViewResult resultsView = new SpecialtyController().EditForm(1) as ViewResult;
            var        result      = resultsView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(Specialty));
        }
Exemplo n.º 3
0
        public void Update_CorrectView_True()
        {
            SpecialtyController controller = new SpecialtyController();
            ActionResult        updateView = controller.Update(1);

            Assert.IsInstanceOfType(updateView, typeof(ViewResult));
        }
Exemplo n.º 4
0
        public void ViewAll_CorrectView_True()
        {
            SpecialtyController controller  = new SpecialtyController();
            ActionResult        viewAllView = controller.ViewAll();

            Assert.IsInstanceOfType(viewAllView, typeof(ViewResult));
        }
Exemplo n.º 5
0
        public void Details_HasCorrectModelType_Dictionary()
        {
            ViewResult resultsView = new SpecialtyController().Details(1) as ViewResult;
            var        result      = resultsView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(Dictionary <string, object>));
        }
Exemplo n.º 6
0
        public void Confirm_CorrectView_True()
        {
            SpecialtyController controller = new SpecialtyController();
            ActionResult        createView = controller.Confirm();

            Assert.IsInstanceOfType(createView, typeof(ViewResult));
        }
Exemplo n.º 7
0
        public void CreateSpecialty_ReturnsCorrectType_ActionResult()
        {
            SpecialtyController controller = new SpecialtyController();
            IActionResult       view       = controller.Create("Name");

            Assert.IsInstanceOfType(view, typeof(ViewResult));
        }
Exemplo n.º 8
0
        public void Show_ReturnsCorrectType_ActionResult()
        {
            SpecialtyController controller = new SpecialtyController();
            IActionResult       view       = controller.Show(1);

            Assert.IsInstanceOfType(view, typeof(ViewResult));
        }
Exemplo n.º 9
0
        public void New_ReturnsCorrectView_True()
        {
            SpecialtyController controller = new SpecialtyController();
            ActionResult        indexView  = controller.New();

            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
Exemplo n.º 10
0
        public void Add_ReturnsCorrectView_True()
        {
            SpecialtyController controller = new SpecialtyController();
            ActionResult        addView    = controller.Add("description");

            Assert.IsInstanceOfType(addView, typeof(RedirectToActionResult));
        }
        public void Delete_ReturnsCorrectType_ActionResult()
        {
            SpecialtyController controller = new SpecialtyController();
            IActionResult       view       = controller.Delete(1);

            Assert.IsInstanceOfType(view, typeof(RedirectToActionResult));
        }
Exemplo n.º 12
0
        private void specialtyButton_Click(object sender, EventArgs e)
        {
            var window         = new SpecialtyForm();
            var specController = new SpecialtyController(_context, window);

            window.ShowDialog();
        }
Exemplo n.º 13
0
        public void Details_ReturnsCorrectView_True()
        {
            SpecialtyController controller  = new SpecialtyController();
            ActionResult        detailsView = controller.Details(1);

            Assert.IsInstanceOfType(detailsView, typeof(ViewResult));
        }
Exemplo n.º 14
0
        public void AddForm_HasCorrectModelType_Object()
        {
            ViewResult resultsView = new SpecialtyController().AddForm() as ViewResult;
            var        result      = resultsView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(List <Specialty>));
        }
Exemplo n.º 15
0
        public void CreateSpecialty_HasCorrectModelType_List()
        {
            ViewResult view   = new SpecialtyController().Create("Name") as ViewResult;
            var        result = view.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(List <Specialty>));
        }
Exemplo n.º 16
0
        public void Index_ReturnsCorrectView_True()
        {
            SpecialtyController controller = new SpecialtyController();
            ActionResult        allView    = controller.Index();

            Assert.IsInstanceOfType(allView, typeof(ViewResult));
        }
Exemplo n.º 17
0
        public void ShowSpecial_ReturnsCorrectView_True()
        {
            SpecialtyController controller = new SpecialtyController();
            ActionResult        view       = controller.ShowSpecial(0);

            Assert.IsInstanceOfType(view, typeof(ViewResult));
        }
Exemplo n.º 18
0
        public void Index_HasCorrectModel_SpecialtyList()
        {
            SpecialtyController controller   = new SpecialtyController();
            IActionResult       actionResult = controller.Index();
            ViewResult          view         = controller.Index() as ViewResult;
            var result = view.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(List <Specialty>));
        }
        public void Details_LinksToCorrect_View()
        {
            //Arrange
            SpecialtyController controller = new SpecialtyController();

            //Act
            ActionResult detailsView = controller.Details(0);

            //Assert
            Assert.IsInstanceOfType(detailsView, typeof(ViewResult));
        }
        public void Index_HasCorrectModelType_SpecialtyList()
        {
            //Arrange
            ViewResult indexView = new SpecialtyController().Index() as ViewResult;

            //Act
            var result = indexView.ViewData.Model;

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <Specialty>));
        }
        public void Index_ReturnsCorrectView_True()
        {
            //Arrange
            SpecialtyController controller = new SpecialtyController();

            //Act
            ActionResult indexView = controller.Index();

            //Assert
            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
        public void CreateForm_ReturnsCorrectView_True()
        {
            //Arrange
            SpecialtyController controller = new SpecialtyController();

            //Act
            ActionResult createFormView = controller.CreateForm();

            //Assert
            Assert.IsInstanceOfType(createFormView, typeof(ViewResult));
        }
Exemplo n.º 23
0
        public void Details_ReturnsCorrectView_True()
        {
            //Arrange
            SpecialtyController controller = new SpecialtyController();
            Client testClient = new Client("connor");

            //Act
            ActionResult indexView = controller.Details(testClient.GetId());

            //Assert
            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
        public void Details_HasCorrectModelType_SpecialtyItem()
        {
            //Arrange
            SpecialtyController controller   = new SpecialtyController();
            IActionResult       actionResult = controller.Details(0);
            ViewResult          detailsView  = controller.Details(0) as ViewResult;

            //Act
            var result = detailsView.ViewData.Model;

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <Client>));
        }
        public void SpecialtyList_Test()
        {
            //Arrange
            SpecialtyController controller   = new SpecialtyController();
            IActionResult       actionResult = controller.Index();
            ViewResult          indexView    = controller.Index() as ViewResult;

            //Act
            var result = indexView.ViewData.Model;

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <Specialty>));
        }
        public void GetSpecialtyById()
        {
            var specialty = new Specialty()
            {
                Id = 1
            };

            mockService.Setup(x => x.GetSpecialty(1)).Returns(specialty);

            var controller = new SpecialtyController(mockService.Object);
            var response   = controller.Get(1);

            Assert.AreEqual(1, response.Specialty.Id);
        }
Exemplo n.º 27
0
        public void Details_ReturnsCorrectView_True()
        {
            //Arrange
            SpecialtyController controller    = new SpecialtyController();
            Specialty           testSpecialty = new Specialty("John", 0);

            testSpecialty.Save();

            //Act
            ActionResult detailsView = controller.Details(testSpecialty.id);

            //Assert
            Assert.IsInstanceOfType(detailsView, typeof(ViewResult));
        }
Exemplo n.º 28
0
        public SpecialtyTests()
        {
            var mockMapper = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(new AutoMapping());
            });

            _mapper = mockMapper.CreateMapper();
            _specialtyRepository = new Mock <ISpecialityRepository>();
            _lectorRepository    = new Mock <ILectorRepository>();
            _facultyRepository   = new Mock <IFacultyRepository>();
            _specialtyService    = new SpecialtyService(_specialtyRepository.Object, _facultyRepository.Object, _lectorRepository.Object);
            _controller          = new SpecialtyController(_specialtyService, _mapper);
        }
Exemplo n.º 29
0
        public void SetUp()
        {
            controllerContext = new HttpControllerContext();

            HttpContext.Current = new HttpContext(new HttpRequest(null, "http://localhost", null), new HttpResponse(null));

            controllerContext.Request = new HttpRequestMessage();

            controllerContext.Request.Headers.Add("Basic", "password");

            controller = new SpecialtyController();

            controller.ControllerContext = controllerContext;
        }
        public void SpecialtyNotFound()
        {
            var specialty = new Specialty()
            {
                Id = 2
            };

            mockService.Setup(x => x.GetSpecialty(2)).Returns(specialty);

            var controller = new SpecialtyController(mockService.Object);
            var response   = controller.Get(1);

            Assert.IsFalse(response.Success);
        }