Esempio n. 1
0
        public void O14OnlyElesInO12()
        {
            //"w:start" element is newly added
            //its class is StartBorder
            //its parent is TableCellBorder
            //its parent should have corresponding attring
            foreach (var attr in typeof(TableCellBorders).GetCustomAttributes(typeof(ChildElementInfoAttribute), false))
            {
                var ce = attr as ChildElementInfoAttribute;
                if (ce.ElementType == typeof(TopBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2007 | FileFormatVersions.Office2010);
                }
                else if (ce.ElementType == typeof(StartBorder) || ce.ElementType == typeof(EndBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2010);
                }
            }

            EndBorder eb = new EndBorder();

            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetCustomAttributes(false).OfType <OfficeAvailabilityAttribute>().First();

            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);

            Assert.True(typeof(TableCellBorders).GetCustomAttributes(false).OfType <OfficeAvailabilityAttribute>().FirstOrDefault() == null);
        }
Esempio n. 2
0
        public void O14OnlyElesInO12()
        {
            //"w:start" element is newly added
            //its class is StartBorder
            //its parent is TableCellBorder
            //its parent should have corresponding attribute
            foreach (var ce in typeof(TableCellBorders).GetTypeInfo().GetCustomAttributes <ChildElementInfoAttribute>(false))
            {
                if (ce.ElementType == typeof(TopBorder))
                {
                    Assert.True((ce.AvailableInVersion & FileFormatVersions.Office2007) > 0);
                    Assert.True((ce.AvailableInVersion & FileFormatVersions.Office2010) > 0);
                }
                else if (ce.ElementType == typeof(StartBorder) || ce.ElementType == typeof(EndBorder))
                {
                    Assert.True((ce.AvailableInVersion & FileFormatVersions.Office2010) > 0);
                }
            }

            EndBorder eb = new EndBorder();

            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetTypeInfo().GetCustomAttributes <OfficeAvailabilityAttribute>(false).First();

            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);
        }
Esempio n. 3
0
        public void O14ElesInO14()
        {
            foreach (var attr in typeof(TableCellBorders).GetCustomAttributes(typeof(ChildElementInfoAttribute), false))
            {
                var ce = attr as ChildElementInfoAttribute;
                if (ce.ElementType == typeof(TopBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2007 | FileFormatVersions.Office2010);
                }
                else if (ce.ElementType == typeof(StartBorder) || ce.ElementType == typeof(EndBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2010);
                }
            }

            EndBorder eb = new EndBorder();

            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetCustomAttributes(false).OfType <OfficeAvailabilityAttribute>().First();

            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);

            Assert.True(typeof(TableCellBorders).GetCustomAttributes(false).OfType <OfficeAvailabilityAttribute>().FirstOrDefault() == null);
        }
Esempio n. 4
0
        public void O14ElesInO14()
        {
            EndBorder eb = new EndBorder();

            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            Assert.True(eb.Metadata.Availability == FileFormatVersions.Office2010);
        }
Esempio n. 5
0
        public void O14ElesInO14()
        {
            EndBorder eb = new EndBorder();

            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetTypeInfo().GetCustomAttributes <OfficeAvailabilityAttribute>(false).First();

            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);
        }
Esempio n. 6
0
        public void O14ElesInO14()
        {
            foreach (var attr in typeof(TableCellBorders).GetTypeInfo().GetCustomAttributes <ChildElementInfoAttribute>(false))
            {
                if (attr.ElementType == typeof(TopBorder))
                {
                    Assert.True(attr.AvailableInVersion.All());
                }
                else if (attr.ElementType == typeof(StartBorder) || attr.ElementType == typeof(EndBorder))
                {
                    Assert.True(attr.AvailableInVersion.Includes(FileFormatVersions.Office2010));
                }
            }

            EndBorder eb = new EndBorder();

            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetTypeInfo().GetCustomAttributes <OfficeAvailabilityAttribute>(false).First();

            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);
        }
Esempio n. 7
0
        public void O14OnlyElesInO12()
        {
            //"w:start" element is newly added 
            //its class is StartBorder
            //its parent is TableCellBorder
            //its parent should have corresponding attring
            foreach (var attr in typeof(TableCellBorders).GetCustomAttributes(typeof(ChildElementInfoAttribute), false))
            {
                var ce = attr as ChildElementInfoAttribute;
                if (ce.ElementType == typeof(TopBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2007 | FileFormatVersions.Office2010);
                }
                else if (ce.ElementType == typeof(StartBorder) || ce.ElementType == typeof(EndBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2010);
                }
            }

            EndBorder eb = new EndBorder();
            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetCustomAttributes(false).OfType<OfficeAvailabilityAttribute>().First();
            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);

            Assert.True(typeof(TableCellBorders).GetCustomAttributes(false).OfType<OfficeAvailabilityAttribute>().FirstOrDefault() == null);
        }
Esempio n. 8
0
        public void O14ElesInO14()
        {
            foreach (var attr in typeof(TableCellBorders).GetCustomAttributes(typeof(ChildElementInfoAttribute), false))
            {
                var ce = attr as ChildElementInfoAttribute;
                if (ce.ElementType == typeof(TopBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2007 | FileFormatVersions.Office2010);
                }
                else if (ce.ElementType == typeof(StartBorder) || ce.ElementType == typeof(EndBorder))
                {
                    Assert.Equal(ce.AvailableInVersion, FileFormatVersions.Office2010);
                }
            }

            EndBorder eb = new EndBorder();
            Assert.True(eb.IsInVersion(FileFormatVersions.Office2010));
            Assert.False(eb.IsInVersion(FileFormatVersions.Office2007));

            var attr1 = typeof(EndBorder).GetCustomAttributes(false).OfType<OfficeAvailabilityAttribute>().First();
            Assert.True(attr1.OfficeVersion == FileFormatVersions.Office2010);

            Assert.True(typeof(TableCellBorders).GetCustomAttributes(false).OfType<OfficeAvailabilityAttribute>().FirstOrDefault() == null);
        }