public void CategoryMetadata_ChildrenList_ShouldBeJustCategories()
        {
            var metadata = new CategoryMetadata();

            metadata.ChildrenList.Should().BeEquivalentTo(new List <Type> {
                typeof(Category)
            });
        }
Esempio n. 2
0
 public ActionResult EditCategory([Bind(Include = "id,category_name")] CategoryMetadata categoryMetadata)
 {
     if (ModelState.IsValid)
     {
         Models.Category category = new Models.Category();
         category.category_name = categoryMetadata.category_name;
         //db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Category"));
     }
     return(View(categoryMetadata));
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
        /// </summary>
        public MainWindowViewModel()
        {
            if ((!SeeingSharpApplication.IsInitialized) ||
                (SampleFactory.Current == null))
            {
                m_allSamples     = new List <SampleViewModel>();
                m_visibleSamples = new ObservableCollection <SampleViewModel>();
                m_categories     = new List <CategoryInfo>();
                return;
            }

            // Initialize main collections
            m_allSamples = new List <SampleViewModel>(
                SampleFactory.Current.GetSampleInfos()
                .Convert <SampleDescription, SampleViewModel>(
                    (actSampleDesc) => new SampleViewModel(actSampleDesc)));
            m_visibleSamples = new ObservableCollection <SampleViewModel>();
            m_categories     = new List <CategoryInfo>(
                (from actSample in m_allSamples
                 select new CategoryInfo(actSample.Category, CategoryMetadata.GetCategoryIconSymbol(actSample.Category)))
                .Distinct(CategoryInfo.EqualityComparer));

            // Initialize commands
            this.CommandShowSource = new DelegateCommand(async() =>
            {
                if (m_selectedSample != null)
                {
                    await Windows.System.Launcher.LaunchUriAsync(
                        new Uri(m_selectedSample.SampleDescription.CodeUrl));
                }
            });

            // Set initial selection
            CommonTools.InvokeDelayed(
                () =>
            {
                this.SelectedCategory = this.Categories.FirstOrDefault();
                this.SelectedSample   = this.VisibleSamples.FirstOrDefault();
            },
                TimeSpan.FromMilliseconds(500));
        }
Esempio n. 4
0
        // GET: Categories
        public ActionResult Category(int?pagenumber)
        {
            CategoryDataOperation category  = new CategoryDataOperation();
            CategoryMetadata      cCategory = new CategoryMetadata();
            //cCategory.pagination = category.GetCategoryRecord().ToPagedList(pagenumber ?? 1, 10);

            List <csp_getTypes_Result> lstCSP_getTypes_Result    = category.GetCategoryRecord();
            List <CategoryMetadata>    lstCustomCategoryMetadata = new List <CategoryMetadata>();

            foreach (csp_getTypes_Result csp_getTypes_Result in lstCSP_getTypes_Result)
            {
                CategoryMetadata customCategoryMetadata = new CategoryMetadata
                {
                    id            = csp_getTypes_Result.Id,
                    category_name = csp_getTypes_Result.Name
                };

                lstCustomCategoryMetadata.Add(customCategoryMetadata);
            }

            return(View(category.GetCategoryRecord()));
        }
        public void CategoryMetadata_AutoBlacklist_ShouldBeTrue()
        {
            var metadata = new CategoryMetadata();

            metadata.AutoBlacklist.Should().BeTrue();
        }
        public void CategoryMetadata_RequiresParent_ShouldBeTrue()
        {
            var metadata = new CategoryMetadata();

            metadata.RequiresParent.Should().BeTrue();
        }
        public void CategoryMetadata_ChildrenListType_ShouldBeWhiteList()
        {
            var metadata = new CategoryMetadata();

            metadata.ChildrenListType.Should().Be(ChildrenListType.WhiteList);
        }
Esempio n. 8
0
        public void CategoryMetadata_AutoBlacklist_ShouldBeTrue()
        {
            var metadata = new CategoryMetadata();

            metadata.AutoBlacklist.Should().BeTrue();
        }
Esempio n. 9
0
        public void CategoryMetadata_RequiresParent_ShouldBeTrue()
        {
            var metadata = new CategoryMetadata();

            metadata.RequiresParent.Should().BeTrue();
        }
Esempio n. 10
0
        public void CategoryMetadata_ChildrenList_ShouldBeJustCategories()
        {
            var metadata = new CategoryMetadata();

            metadata.ChildrenList.Should().BeEquivalentTo(new List<Type>{typeof(Category)});
        }
Esempio n. 11
0
        public void CategoryMetadata_ChildrenListType_ShouldBeWhiteList()
        {
            var metadata = new CategoryMetadata();

            metadata.ChildrenListType.Should().Be(ChildrenListType.WhiteList);
        }