public void Header_Of_IHeadered_Items_Should_Be_Used()
        {
            var items = new[]
            {
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
                Mock.Of <IHeadered>(x => x.Header == "foo"),
                Mock.Of <IHeadered>(x => x.Header == "bar"),
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
            };

            var target = new TabStrip
            {
                Template = new FuncControlTemplate <TabStrip>(CreateTabStripTemplate),
                Items    = items,
            };

            target.ApplyTemplate();
            target.Presenter.ApplyTemplate();

            var result = target.GetLogicalChildren()
                         .OfType <TabStripItem>()
                         .Select(x => x.Content)
                         .ToList();

            Assert.Equal(new[] { "foo", "bar" }, result);
        }
Example #2
0
        public void Data_Of_Non_IHeadered_Items_Should_Be_Used()
        {
            var items = new[]
            {
                "foo",
                "bar"
            };

            var target = new TabStrip
            {
                Template = new FuncControlTemplate <TabStrip>(CreateTabStripTemplate),
                Items    = items,
            };

            target.ApplyTemplate();

            var result = target.GetLogicalChildren()
                         .OfType <TabStripItem>()
                         .Select(x => x.Content)
                         .ToList();

            Assert.Equal(new[] { "foo", "bar" }, result);
        }