Exemple #1
0
        public void ToXmlTest_ShouldReturnNonNullXElement()
        {
            //Arrange
            C1DataColumn column = new C1DataColumn();

            column.ValueItems = new ValueItemCollection();
            //Act
            var actualResult = column.ToXML();

            //Assert
            Assert.IsNotNull(actualResult);
        }
Exemple #2
0
        public void ToXmlTest_DefinedCaptionDataFieldPresentation_ShouldReturnXElementWithPropertiesSet()
        {
            //Arrange
            C1DataColumn column = new C1DataColumn();

            column.Properties["Caption"]   = "abc";
            column.Properties["DataField"] = "def";
            column.ValueItems = new ValueItemCollection();
            column.ValueItems.Properties["Presentation"] = "ComboBox";
            string expectedResult = "C1DataColumn abc def ComboBox";
            //Act
            XElement c1DataColumnElement = column.ToXML();
            string   actualResult        = c1DataColumnElement.Name.LocalName + " " + c1DataColumnElement.Attribute("Caption").Value + " " + c1DataColumnElement.Attribute("DataField").Value + " " + c1DataColumnElement.Element("ValueItems").Attribute("Presentation").Value;

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Exemple #3
0
        public void ToXmlTest_HasBaseXml()
        {
            // Arrange
            C1DataColumn  column         = new C1DataColumn();
            XElement      columnXelement = column.ToXML();
            List <string> baseAttributes = new List <string>();

            baseAttributes.Add("Caption");
            baseAttributes.Add("DataField");
            List <string> baseElements = new List <string>();

            baseElements.Add("FilterCancelText");
            baseElements.Add("FilterClearText");
            baseElements.Add("ValueItems");
            baseElements.Add("GroupInfo");
            // Act
            bool actualResult = baseAttributes.TrueForAll(x => columnXelement.Attribute(x) != null) &&
                                baseElements.TrueForAll(x => columnXelement.Element(x) != null) &&
                                columnXelement.Element("GroupInfo").Element("AggregatesText") != null;

            // Assert
            Assert.IsTrue(actualResult);
        }