Пример #1
0
        public void List_ValidSectionListViewModel_ReturnViewWithSectionListViewModel()
        {
            // Arrange
            var mockService = new Mock <ISectionService>();

            mockService.Setup(service => service.GetAllRouteSections())
            .Returns(new List <RouteSection> {
                new RouteSection(), new RouteSection()
            });
            mockService.Setup(service => service.GetAllRouteHalls())
            .Returns(new List <RouteHall> {
                new RouteHall(), new RouteHall()
            });
            SectionController controller = new SectionController(mockService.Object);

            // Act
            var result = controller.List();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <SectionListViewModel>(
                viewResult.ViewData.Model);

            Assert.Equal(2, model.Sections.Count);
            Assert.Equal(2, model.Halls.Count);
        }
Пример #2
0
        /// <summary>
        /// Удаление нода, который представляет склад, раздел или продукт.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Удалить выбранный узел?", "Удаление узла", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                TreeNode selectedNode = treeView.SelectedNode;
                TreeNode parentNode   = selectedNode.Parent;

                if (selectedNode.Tag is StorageModel storageModel)
                {
                    StorageController.DeleteStorage(storageModel);
                }

                if (selectedNode.Tag is SectionModel sectionModel)
                {
                    SectionController.DeleteSection((IStorable)parentNode.Tag, sectionModel);
                }

                if (selectedNode.Tag is ProductModel productModel)
                {
                    ProductController.DeleteProduct(parentNode.Tag as SectionModel, productModel);
                }

                UpdateListViewItems();
                selectedNode.Remove();
            }
        }
Пример #3
0
        public void SectionController_RespondsToIsBusyChanged()
        {
            // Arrange
            SectionController    testSubject = this.CreateTestSubject();
            ITeamExplorerSection viewModel   = testSubject.ViewModel;

            // Act
            this.host.TestStateManager.SetAndInvokeBusyChanged(true);

            // Assert
            viewModel.IsBusy.Should().BeTrue();

            // Act again (different value)
            this.host.TestStateManager.SetAndInvokeBusyChanged(false);

            // Assert (should change)
            viewModel.IsBusy.Should().BeFalse();

            // Dispose
            testSubject.Dispose();

            // Act again(different value)
            this.host.TestStateManager.SetAndInvokeBusyChanged(true);

            // Assert (should remain the same)
            viewModel.IsBusy.Should().BeFalse();
        }
        public void AddAsignacion_WhenCalledWithReturnhNotNull__ReturnsBadRequestResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Models.SectionWithoutAreaDto
            {
                Id     = 1,
                Nombre = "Asignacion_1"
            };

            var returnsSection = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            mockRepository.Setup(r => r.GetSection(1, false)).Returns(returnsSection);
            mockRepository.Setup(r => r.AddSection(It.IsAny <everisapi.API.Entities.SectionEntity>())).Returns(true);

            //Act
            var okResult = _controller.AddAsignacion(section);

            //Assert
            Assert.IsType <BadRequestResult>(okResult);
        }
        public void DeleteSection_WhenCalled_ReturnOkResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Models.SectionWithoutAreaDto
            {
                Id     = 1,
                Nombre = "Asignacion_1"
            };

            var returnsSection = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(returnsSection);
            mockRepository.Setup(r => r.DeleteSection(It.IsAny <everisapi.API.Entities.SectionEntity>())).Returns(true);

            //Act
            var okResult = _controller.DeleteSection(section);

            //Assert
            Assert.IsType <OkObjectResult>(okResult);
        }
        public void AddNotas_WhenCalledWithWithInValidModel_ReturnsBadRequestObjectResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);
            _controller.ModelState.AddModelError("error", "some error");

            var section = new everisapi.API.Models.SectionWithNotasDto
            {
                EvaluacionId = 1,
                SectionId    = 1,
                Notas        = "Notas_1"
            };

            var returnsSection = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(returnsSection);
            mockRepository.Setup(r => r.AddNotasSection(It.IsAny <everisapi.API.Models.SectionWithNotasDto>())).Returns(true);

            //Act
            var okResult = _controller.AddNotas(section);

            //Assert
            Assert.IsType <BadRequestObjectResult>(okResult);
        }
        public void AddNotas_WhenCalledThrowException_ReturnsStatusCodeResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Models.SectionWithNotasDto
            {
                EvaluacionId = 1,
                SectionId    = 1,
                Notas        = "Notas_1"
            };

            var returnsSection = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(returnsSection);
            mockRepository.Setup(r => r.AddNotasSection(It.IsAny <everisapi.API.Models.SectionWithNotasDto>())).Throws(new Exception());

            //Act
            var okResult = _controller.AddNotas(section);

            //Assert
            Assert.IsType <ObjectResult>(okResult);
        }
        public void GetAsignacionesFromSection_WhenCalled_ReturnOkResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            var asignaciones = new List <everisapi.API.Models.AsignacionSinPreguntasDto> {
                new everisapi.API.Models.AsignacionSinPreguntasDto {
                    Id = 1
                }
            };

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(section);
            mockRepository.Setup(r => r.GetAsignacionesFromSection(It.IsAny <everisapi.API.Entities.SectionEntity>(), It.IsAny <int>())).Returns(asignaciones);

            //Act
            var okResult = _controller.GetAsignacionesFromSection(1, 1);

            //Assert
            Assert.IsType <OkObjectResult>(okResult);
        }
Пример #9
0
        private SectionController CreateTestSubject(IWebBrowser webBrowser = null)
        {
            var controller = new SectionController(host, webBrowser ?? new ConfigurableWebBrowser());

            controller.Initialize(null, new SectionInitializeEventArgs(new ServiceContainer(), null));
            return(controller);
        }
        private void textBoxSearchSection_TextChanged(object sender, EventArgs e)
        {
            string search = textBoxSearchSection.Text;
            var    ds     = SectionController.SearchSectios(search);

            dataGridViewSection.DataSource = ds;
        }
Пример #11
0
        public void SectionController_Initialization()
        {
            // Act
            SectionController testSubject = this.CreateTestSubject();

            // Constructor time initialization
            testSubject.ConnectCommand.Should().NotBeNull("ConnectCommand is not initialized");
            testSubject.BindCommand.Should().NotBeNull("BindCommand is not initialized");
            testSubject.BrowseToUrlCommand.Should().NotBeNull("BrowseToUrlCommand is not initialized");
            testSubject.BrowseToProjectDashboardCommand.Should().NotBeNull("BrowseToProjectDashboardCommand is not initialized");
            testSubject.DisconnectCommand.Should().NotBeNull("DisconnectCommand is not initialized");
            testSubject.RefreshCommand.Should().NotBeNull("RefreshCommand is not initialized");
            testSubject.ToggleShowAllProjectsCommand.Should().NotBeNull("ToggleShowAllProjectsCommand is not initialized");

            // Case 1: first time initialization
            // Assert
            testSubject.View.Should().NotBeNull("Failed to get the View");
            ((ISectionController)testSubject).View.Should().NotBeNull("Failed to get the View as ConnectSectionView");
            testSubject.ViewModel.Should().NotBeNull("Failed to get the ViewModel");

            // Case 2: re-initialization with connection but no projects
            this.host.TestStateManager.IsConnected = true;
            ReInitialize(testSubject, this.host);

            // Assert
            AssertCommandsInSync(testSubject);
            testSubject.View.Should().NotBeNull("Failed to get the View");
            testSubject.ViewModel.Should().NotBeNull("Failed to get the ViewModel");

            // Case 3: re-initialization with connection and projects
            var projects = new[] { new SonarQubeProject("", "") };

            ReInitialize(testSubject, this.host);

            // Assert
            AssertCommandsInSync(testSubject);
            testSubject.View.Should().NotBeNull("Failed to get the View");
            testSubject.ViewModel.Should().NotBeNull("Failed to get the ViewModel");

            // Case 4: re-initialization with no connection
            this.host.TestStateManager.IsConnected = false;
            ReInitialize(testSubject, this.host);

            // Assert
            AssertCommandsInSync(testSubject);
            testSubject.View.Should().NotBeNull("Failed to get the View");
            testSubject.ViewModel.Should().NotBeNull("Failed to get the ViewModel");

            // Case 5: Dispose
            testSubject.Dispose();

            // Assert
            testSubject.ConnectCommand.Should().BeNull("ConnectCommand is not cleared");
            testSubject.RefreshCommand.Should().BeNull("RefreshCommand is not cleared");
            testSubject.DisconnectCommand.Should().BeNull("DisconnectCommand is not cleared");
            testSubject.BindCommand.Should().BeNull("BindCommand is not ;");
            testSubject.ToggleShowAllProjectsCommand.Should().BeNull("ToggleShowAllProjectsCommand is not cleared");
            testSubject.BrowseToUrlCommand.Should().BeNull("BrowseToUrlCommand is not cleared");
            testSubject.BrowseToProjectDashboardCommand.Should().BeNull("BrowseToProjectDashboardCommand is not cleared");
        }
    protected override void SetSongObjectAndController()
    {
        section = new Section("Default", 0);

        controller         = GetComponent <SectionController>();
        controller.section = section;
    }
Пример #13
0
    public void CreateSection()
    {
        float h = sectionPrefab.GetComponent <Renderer>().bounds.size.z;

        var obj = Instantiate(sectionPrefab) as GameObject;

        obj.transform.parent = this.gameObject.transform;

        obj.transform.position = position;
        SectionController sectionController = obj.GetComponent <SectionController>() as SectionController;

        if (map == null)
        {
            map = new int[] { 0, 0, 0, 0, 0, 0 }
        }
        ;
        else
        {
            map = getNewMap(map);
        }
        sectionController.StudentsMap = map;

        sections.Enqueue(obj);
        position.z += h;
    }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete " + section.SectionName + "? Student list, classes and attendance data of this section will be permanently deleted", "Confirmation", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                SectionController        scontroller  = new SectionController();
                SectionTimeController    stcontroller = new SectionTimeController();
                SectionStudentController sscontroller = new SectionStudentController();
                try
                {
                    ClassController      ccontroller = new ClassController();
                    List <ClassModel>    classList   = ccontroller.GetBySectionId(section.Id);
                    AttendanceController acontroller = new AttendanceController();

                    foreach (ClassModel Class in classList)
                    {
                        acontroller.DeleteAllByClass(Class.Id);
                    }

                    ccontroller.DeleteAllBySection(section.Id);
                    sscontroller.RemoveAllBySection(section.Id);
                    stcontroller.RemoveAllBySection(section.Id);
                    scontroller.Delete(section);
                    MessageBox.Show("Deleted!");
                    buttonBack.PerformClick();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
        public void GetAsignacionesFromSection_WhenCalledThrowException_ReturnsStatusCodeResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            var asignaciones = new List <everisapi.API.Entities.AsignacionEntity> {
                new everisapi.API.Entities.AsignacionEntity {
                    Id = 1
                }
            };

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(section);
            mockRepository.Setup(r => r.GetAsignacionesFromSection(It.IsAny <everisapi.API.Entities.SectionEntity>(), It.IsAny <int>())).Throws(new Exception());

            //Act
            var okResult = _controller.GetAsignacionesFromSection(1, 1);

            //Assert
            Assert.IsType <ObjectResult>(okResult);
        }
Пример #16
0
        private void AssertCommandsInSync(SectionController section)
        {
            ConnectSectionViewModel viewModel = (ConnectSectionViewModel)section.ViewModel;

            viewModel.ConnectCommand.Should().Be(section.ConnectCommand, "ConnectCommand is not initialized");
            viewModel.BindCommand.Should().Be(section.BindCommand, "BindCommand is not initialized");
            viewModel.BrowseToUrlCommand.Should().Be(section.BrowseToUrlCommand, "BrowseToUrlCommand is not initialized");
        }
Пример #17
0
    protected override void Assign(SongObjectController sCon, SongObject songObject)
    {
        SectionController controller = sCon as SectionController;

        // Assign pooled objects
        controller.section = (Section)songObject;
        controller.gameObject.SetActive(true);
    }
        public override Fragment GetItem(int position)
        {
            var shellContent = SectionController.GetItems()[position];

            return(new ShellFragmentContainer(shellContent)
            {
                Arguments = Bundle.Empty
            });
        }
Пример #19
0
        public SectionController GetController()
        {
            var sectionRepository = new SectionRepository();

            _controller = new SectionController(sectionRepository);

            _controller.Request = new HttpRequestMessage();
            _controller.Request.SetConfiguration(new HttpConfiguration());

            return(_controller);
        }
Пример #20
0
        private static void ReInitialize(SectionController controller, IHost host)
        {
            host.ClearActiveSection();
            host.VisualStateManager.ManagedState.ConnectedServers.Clear();
            controller.Initialize(null, new Microsoft.TeamFoundation.Controls.SectionInitializeEventArgs(new ServiceContainer(), null));
            bool refreshCalled = false;

            controller.RefreshCommand = new RelayCommand <ConnectionInformation>(c => refreshCalled = true);
            controller.Refresh();
            refreshCalled.Should().BeTrue("Refresh command execution was expected");
        }
        public AllClassesForm(FacultyUserModel gotFaculty)
        {
            InitializeComponent();
            faculty           = gotFaculty;
            labelWelcome.Text = faculty.FullName;

            try
            {
                ClassController   ccontroller    = new ClassController();
                List <ClassModel> allClassesList = ccontroller.GetByFacultyId(faculty.Id);
                //Console.WriteLine(allClassesList.Count + " improper classes");
                List <ProperClassModel> properClassList = new List <ProperClassModel>();
                foreach (ClassModel model in allClassesList)
                {
                    ProperClassModel properModel = new ProperClassModel();
                    properModel.ClassDate   = model.ClassDate;
                    properModel.ClassType   = model.ClassType;
                    properModel.EndTimeId   = model.EndTimeId;
                    properModel.Id          = model.Id;
                    properModel.RoomNo      = model.RoomNo;
                    properModel.SectionId   = model.SectionId;
                    properModel.StartTimeId = model.StartTimeId;

                    //Console.WriteLine("improper date: " + model.ClassDate + " | proper date: " + properModel.ClassDate);

                    SectionController scontroller = new SectionController();
                    properModel.SectionName = scontroller.Get(model.SectionId).SectionName;

                    ClassTimeController ctcontroller = new ClassTimeController();
                    properModel.Time = ctcontroller.Get(model.StartTimeId).ClassTimeText + " - " + ctcontroller.Get(model.EndTimeId).ClassTimeText;

                    properClassList.Add(properModel);
                }
                MySortableBindingList <ProperClassModel> bindingClassesList = new MySortableBindingList <ProperClassModel>(properClassList);
                //Console.WriteLine(bindingClassesList.Count + " classes found");
                dataGridViewClassList.AutoGenerateColumns = false;
                dataGridViewClassList.DataSource          = bindingClassesList;
                dataGridViewSerial.AutoGenerateColumns    = false;
                dataGridViewSerial.DataSource             = bindingClassesList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            dataGridViewSerial.DataBindingComplete += (o, e) =>
            {
                foreach (DataGridViewRow row in dataGridViewSerial.Rows)
                {
                    row.Cells["sln"].Value = (row.Index + 1).ToString();
                }
            };
        }
        public void GetDatosEvaluacionFromEvalNew_WhenCalledNull_ReturnsNotFoundResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            List <everisapi.API.Models.SectionInfoDto> sections = null;

            mockRepository.Setup(r => r.GetSectionsInfoFromEvalNew(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(sections);

            //Act
            var okResult = _controller.GetDatosEvaluacionFromEvalNew(1, 1, 1);

            //Assert
            Assert.IsType <NotFoundResult>(okResult);
        }
        public void GetSection_WhenCalledNull_ReturnNotFoundResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            everisapi.API.Entities.SectionEntity section = null;

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(section);

            //Act
            var okResult = _controller.GetSection(1, false);

            //Assert
            Assert.IsType <NotFoundResult>(okResult);
        }
#pragma warning disable RCS1168 // Parameter name differs from base name.
        public override int GetItemPosition(Object objectValue)
#pragma warning restore RCS1168 // Parameter name differs from base name.
        {
            var fragContainer = objectValue as ShellFragmentContainer;
            var shellContent  = fragContainer?.ShellContentTab;

            if (shellContent != null)
            {
                int index = SectionController.GetItems().IndexOf(shellContent);
                if (index >= 0)
                {
                    return(index);
                }
            }
            return(PositionNone);
        }
Пример #25
0
        void TabLayoutMediator.ITabConfigurationStrategy.OnConfigureTab(TabLayout.Tab tab, int position)
        {
            if (_selecting)
            {
                return;
            }

            tab.SetText(new String(SectionController.GetItems()[position].Title));
            // TODO : Find a way to make this cancellable
            var shellSection = ShellSection;
            var shellContent = SectionController.GetItems()[position];

            if (shellContent == shellSection.CurrentItem)
            {
                return;
            }

            var  stack  = shellSection.Stack.ToList();
            bool result = ShellController.ProposeNavigation(ShellNavigationSource.ShellContentChanged,
                                                            (ShellItem)shellSection.Parent, shellSection, shellContent, stack, true);

            if (result)
            {
                UpdateCurrentItem(shellContent);
            }
            else if (shellSection?.CurrentItem != null)
            {
                var currentPosition = SectionController.GetItems().IndexOf(shellSection.CurrentItem);
                _selecting = true;

                // Android doesn't really appreciate you calling SetCurrentItem inside a OnPageSelected callback.
                // It wont crash but the way its programmed doesn't really anticipate re-entrancy around that method
                // and it ends up going to the wrong location. Thus we must invoke.

                Device.BeginInvokeOnMainThread(() =>
                {
                    if (currentPosition < _viewPager.ChildCount && _toolbarTracker != null)
                    {
                        _viewPager.SetCurrentItem(currentPosition, false);
                        UpdateCurrentItem(shellSection.CurrentItem);
                    }

                    _selecting = false;
                });
            }
        }
Пример #26
0
        void ViewPager.IOnPageChangeListener.OnPageSelected(int position)
        {
            if (_selecting)
            {
                return;
            }

            // TODO : Find a way to make this cancellable
            var shellSection = ShellSection;
            var shellContent = SectionController.GetItems()[position];

            if (shellContent == shellSection.CurrentItem)
            {
                return;
            }

            var  stack  = shellSection.Stack.ToList();
            bool result = ((IShellController)_shellContext.Shell).ProposeNavigation(ShellNavigationSource.ShellContentChanged,
                                                                                    (ShellItem)shellSection.Parent, shellSection, shellContent, stack, true);

            if (result)
            {
                UpdateCurrentItem(shellContent);
            }
            else
            {
                _selecting = true;

                // Android doesn't really appreciate you calling SetCurrentItem inside a OnPageSelected callback.
                // It wont crash but the way its programmed doesn't really anticipate re-entrancy around that method
                // and it ends up going to the wrong location. Thus we must invoke.

                Device.BeginInvokeOnMainThread(() =>
                {
                    if (position < _viewPager.ChildCount && _toolbarTracker != null)
                    {
                        _viewPager.SetCurrentItem(position, false);
                        UpdateCurrentItem(shellContent);
                    }

                    _selecting = false;
                });
            }
        }
Пример #27
0
        public static void SyncToCanvas()
        {
            logger.Info("SectionService/SyncToCanvas - Task 'Sync section' STARTED");

            try
            {
                SyncronizationDAL.SyncToCanvas();

                List <sp_get_uniCanvas_ws_secciones_Result> sectionToSyncList = SectionDAL.SectionsToSync();

                foreach (sp_get_uniCanvas_ws_secciones_Result sectionToSync in sectionToSyncList)
                {
                    try
                    {
                        SectionController sectionController = new SectionController();
                        Section           section           = new Section();

                        section.course_section = new SectionDTO(sectionToSync);

                        SectionDTO newSection = (SectionDTO)sectionController.Create(section, section.course_section.sis_course_id);

                        if (newSection != null)
                        {
                            SectionDAL.UpdateCanvasData((int)sectionToSync.IDAcademico, newSection, newSection.group_id);
                        }
                        logger.Info("SectionService/SyncToCanvas - Task 'Sync section' FINISHED");
                    }
                    catch (Exception e)
                    {
                        logger.Error("SectionService/SyncToCanvas - Task 'Sync section' FINISHED WITH ERROR: \n " + "  Message: " + e.Message + "\nInner Exception: " + e.InnerException);
                        SectionDTO newSection = new SectionDTO()
                        {
                            error_message = e.Message
                        };
                        SectionDAL.UpdateCanvasData((int)sectionToSync.IDAcademico, newSection, newSection.group_id);
                    }
                }
            }
            catch (Exception e)
            {
                return;
            }
        }
        public void GetNumRespuestas_WhenCalled_ReturnOkResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Entities.SectionEntity
            {
                Id = 1
            };

            mockRepository.Setup(r => r.GetSection(It.IsAny <int>(), It.IsAny <bool>())).Returns(section);
            mockRepository.Setup(r => r.GetRespuestasCorrectasFromSection(It.IsAny <int>(), It.IsAny <int>())).Returns(It.IsAny <int>());

            //Act
            var okResult = _controller.GetNumRespuestas(1, 1);

            //Assert
            Assert.IsType <OkObjectResult>(okResult);
        }
Пример #29
0
        public void GetStudentInfo(Student s)
        {
            int sId   = s.sId;
            int secId = s.secId;
            int cId   = s.cId;

            textBoxName.Text            = s.name;
            textBoxClass.Text           = ClassController.GetClass(cId).clas.ToString();
            textBoxSection.Text         = SectionController.GetSection(secId).secName.ToString();
            textBoxFathersName.Text     = s.fatherName;
            textBoxMothersName.Text     = s.motherName;
            textBoxRoll.Text            = s.roll;
            textBoxDateOfBirth.Text     = s.dateOfBirth.ToString();
            textBoxDateOfAdmission.Text = s.dateOfAdmission.ToString();
            textBoxContact.Text         = s.contact;
            richTextBoxAddress.Text     = s.address;
            textBoxGender.Text          = s.gender;
            textBoxRoll.Text            = s.roll;
        }
        public void GetSectionsInfoFromSectionId_WhenCalled_ReturnOkResult()
        {
            //Arrange
            _controller = new SectionController(_logger, _sectionInfoRepository);

            var section = new everisapi.API.Models.SectionInfoDto
            {
                Id     = 1,
                Nombre = "Section_1"
            };

            mockRepository.Setup(r => r.GetSectionsInfoFromSectionId(It.IsAny <int>(), It.IsAny <int>())).Returns(section);

            //Act
            var okResult = _controller.GetSectionsInfoFromSectionId(1, 1);

            //Assert
            Assert.IsType <OkObjectResult>(okResult);
        }
Пример #31
0
 public static SectionController Fixture()
 {
     SectionController controller = new SectionController(new SectionRepository(), "", new LoginView());
     return controller;
 }