Esempio n. 1
0
 public IHttpActionResult GetEducations()
 {
     try
     {
         return(Ok(_educationService.GetEducations()));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
    public async Task GetEducations()
    {
        // Arrange
        var svc = new EducationService();

        // Act
        var result = await svc.GetEducations();

        // Assert
        Assert.Equal(2, result.Count);
    }
Esempio n. 3
0
        public void GetEducationsShouldReturnAllEducations()
        {
            var options   = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase("Database_For_Videos").Options;
            var dbContext = new ApplicationDbContext(options);
            var service   = new EducationService(dbContext);

            dbContext.Educations.Add(new Education());
            dbContext.Educations.Add(new Education());
            dbContext.Educations.Add(new Education());
            dbContext.Educations.Add(new Education());
            dbContext.Educations.Add(new Education());
            dbContext.SaveChanges();

            var educations = service.GetEducations();

            Assert.Equal(5, educations.Length);
        }
Esempio n. 4
0
        private void LoadDataGridLookUpEditEducations()
        {
            var items      = _educationService.GetEducations();
            var collection = new AutoCompleteStringCollection();

            foreach (var item in items)
            {
                collection.Add(item.EduName);
            }
            gridLookUpEditEducation.MaskBox.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            gridLookUpEditEducation.MaskBox.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            gridLookUpEditEducation.MaskBox.AutoCompleteCustomSource = collection;

            gridLookUpEditEducation.Properties.DisplayMember  = "EduName";
            gridLookUpEditEducation.Properties.ValueMember    = "EduCode";
            gridLookUpEditEducation.Properties.PopupFormWidth = 300;
            gridLookUpEditEducation.Properties.DataSource     = items;
        }