Exemple #1
0
 public void VersionTest()
 {
     AtomGenerator target = new AtomGenerator(); // TODO: Initialize to an appropriate value
     string expected = "TestValue";            
     string actual;
     target.Version = expected;
     actual = target.Version;
     Assert.AreEqual(expected, actual);
 }
        ///<summary>Standard type converter method</summary>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
        {
            AtomGenerator generator = value as AtomGenerator;

            if (destinationType == typeof(System.String) && generator != null)
            {
                return(generator.Text);
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Exemple #3
0
        /////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////////////////////////////////////////
        /// <summary>parses an AtomGenerator</summary>
        /// <param name="reader">the xmlreader correctly positioned at the generator </param>
        /// <param name="owner">the container element</param>
        /// <returns> </returns>
        //////////////////////////////////////////////////////////////////////
        protected AtomGenerator ParseGenerator(XmlReader reader, AtomBase owner)
        {
            //    atomGenerator = element atom:generator {
            //    atomCommonAttributes,
            //    attribute url { atomUri }?,
            //    attribute version { text }?,
            //    text
            //     }

            Tracing.Assert(reader != null, "reader should not be null");
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }


            Tracing.TraceCall();
            AtomGenerator generator = owner.CreateAtomSubElement(reader, this) as AtomGenerator;

            if (generator != null)
            {
                generator.Text = Utilities.DecodedValue(reader.ReadString());
                if (reader.HasAttributes)
                {
                    while (reader.MoveToNextAttribute())
                    {
                        object attributeName = reader.LocalName;

                        if (attributeName.Equals(this.nameTable.Uri))
                        {
                            generator.Uri = new AtomUri(reader.Value);
                        }
                        else if (attributeName.Equals(this.nameTable.Version))
                        {
                            generator.Version = Utilities.DecodedValue(reader.Value);
                        }
                        else
                        {
                            ParseBaseAttributes(reader, generator);
                        }
                    }
                }
            }

            return(generator);
        }
       /////////////////////////////////////////////////////////////////////////////

       //////////////////////////////////////////////////////////////////////
       /// <summary>compares 2 Generator objects</summary> 
       /// <param name="theOne">the One</param>
       /// <param name="theOther">the Other</param>
       /// <returns>true if identical </returns>
       //////////////////////////////////////////////////////////////////////
       public static bool IsGeneratorIdentical(AtomGenerator theOne, AtomGenerator theOther)
       {
           if (theOne == null && theOther == null)
           {
               return true;
           }

           if (ObjectModelHelper.IsBaseIdentical(theOne, theOther)==false)
           {
               return false;
           }

            if (String.Compare(theOne.Text, theOther.Text)!= 0)
            {
                return false;
            }
            if (String.Compare(theOne.Version, theOther.Version)!=0)
            {
                return false;
            }
            if (AtomUri.Compare(theOne.Uri, theOther.Uri)!=0)
            {
                return false;
            }


           return true;
       }
Exemple #5
0
 public void UriTest()
 {
     AtomGenerator target = new AtomGenerator(); // TODO: Initialize to an appropriate value
     AtomUri expected = new AtomUri("http://www.test.com/");
     AtomUri actual;
     target.Uri = expected;
     actual = target.Uri;
     Assert.AreEqual(expected, actual);
 }
Exemple #6
0
 public void XmlNameTest()
 {
     AtomGenerator target = new AtomGenerator(); // TODO: Initialize to an appropriate value
     Assert.AreEqual(AtomParserNameTable.XmlGeneratorElement, target.XmlName);
 }
Exemple #7
0
 public void AtomGeneratorConstructorTest()
 {
     string text = "test";
     AtomGenerator target = new AtomGenerator(text);
     Assert.AreEqual(text, target.Text);
 }
Exemple #8
0
 public void AtomGeneratorConstructorTest1()
 {
     AtomGenerator target = new AtomGenerator();
     Assert.IsNotNull(target);
     Assert.IsTrue(String.IsNullOrEmpty(target.Text));
 }
Exemple #9
0
 public void ShouldBePersistedTest()
 {
     AtomGenerator target = new AtomGenerator(); // TODO: Initialize to an appropriate value
     target.Text = "dirty";
     Assert.IsTrue(target.ShouldBePersisted());
 }
Exemple #10
0
 public void GeneratorTest()
 {
     AtomSource target = new AtomSource(); // TODO: Initialize to an appropriate value
     AtomGenerator expected = new AtomGenerator();
     AtomGenerator actual;
     target.Generator = expected;
     actual = target.Generator;
     Assert.AreEqual(expected, actual);
 }