Пример #1
0
        public void AllAttributesEmptyOrNull_TwoAttributesOneWithValues()
        {
            Element element = new Element();

            element.MaxOccurs     = 1;
            element.MinOccurs     = 0;
            element.Name          = "baseElement";
            element.Parent        = null;
            element.RootElement   = true;
            element.SpecialLength = false;
            element.Type          = "DataType.String";
            element.Value         = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced    = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name   = "attributeName";
            attribute.Parent = element;

            element.Attributes.Add(attribute);

            NewRelic.AgentConfiguration.Parts.Attribute attribute2 = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute2.Name   = "attribute2Name";
            attribute2.Parent = element;
            attribute2.Value  = "attribute2Value";

            element.Attributes.Add(attribute2);

            Assert.IsFalse(element.AllAttributesEmptyOrNull());
        }
        public void AllAttributesEmptyOrNull_TwoAttributesOneWithValues()
        {
            Element element = new Element();
            element.MaxOccurs = 1;
            element.MinOccurs = 0;
            element.Name = "baseElement";
            element.Parent = null;
            element.RootElement = true;
            element.SpecialLength = false;
            element.Type = "DataType.String";
            element.Value = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name = "attributeName";
            attribute.Parent = element;

            element.Attributes.Add(attribute);

            NewRelic.AgentConfiguration.Parts.Attribute attribute2 = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute2.Name = "attribute2Name";
            attribute2.Parent = element;
            attribute2.Value = "attribute2Value";

            element.Attributes.Add(attribute2);

            Assert.IsFalse(element.AllAttributesEmptyOrNull());
        }
Пример #3
0
        public void FindAttribute_Success()
        {
            Element element = new Element();

            element.MaxOccurs     = 1;
            element.MinOccurs     = 0;
            element.Name          = "baseElement";
            element.Parent        = null;
            element.RootElement   = true;
            element.SpecialLength = false;
            element.Type          = "DataType.String";
            element.Value         = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced    = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name   = "attributeName";
            attribute.Parent = element;

            NewRelic.AgentConfiguration.Parts.Attribute attribute2 = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute2.Name   = "attributeName2";
            attribute2.Parent = element;

            element.Attributes.Add(attribute);
            element.Attributes.Add(attribute2);

            Assert.IsTrue(attribute.Name == element.FindAttribute(attribute).Name);
        }
Пример #4
0
        public void OnlyAttributeEmptyOrNull_OneAttributeOnlyNoValue()
        {
            Element element = new Element();

            element.MaxOccurs     = 1;
            element.MinOccurs     = 0;
            element.Name          = "baseElement";
            element.Parent        = null;
            element.RootElement   = true;
            element.SpecialLength = false;
            element.Type          = "DataType.String";
            element.Value         = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced    = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name   = "attributeName";
            attribute.Parent = element;

            element.Attributes.Add(attribute);

            Assert.IsTrue(element.OnlyAttributeEmptyOrNull());
        }
        public void OnlyAttributeEmptyOrNull_OneAttributeOnlyNoValue()
        {
            Element element = new Element();
            element.MaxOccurs = 1;
            element.MinOccurs = 0;
            element.Name = "baseElement";
            element.Parent = null;
            element.RootElement = true;
            element.SpecialLength = false;
            element.Type = "DataType.String";
            element.Value = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name = "attributeName";
            attribute.Parent = element;

            element.Attributes.Add(attribute);

            Assert.IsTrue(element.OnlyAttributeEmptyOrNull());
        }
        public void FindAttribute_Success()
        {
            Element element = new Element();
            element.MaxOccurs = 1;
            element.MinOccurs = 0;
            element.Name = "baseElement";
            element.Parent = null;
            element.RootElement = true;
            element.SpecialLength = false;
            element.Type = "DataType.String";
            element.Value = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name = "attributeName";
            attribute.Parent = element;

            NewRelic.AgentConfiguration.Parts.Attribute attribute2 = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute2.Name = "attributeName2";
            attribute2.Parent = element;

            element.Attributes.Add(attribute);
            element.Attributes.Add(attribute2);

            Assert.IsTrue(attribute.Name == element.FindAttribute(attribute).Name);
        }
Пример #7
0
 public void StandAloneElement_Attribute()
 {
     NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
     Assert.IsFalse(Methods.StandAloneElement(attribute));
 }
        public void Clone_SuccessNoValue()
        {
            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Default = "baseDefault";
            attribute.Use = "baseUse";
            attribute.Name = "baseAttribute";
            attribute.Parent = null;

            Restriction restriction = new Restriction();
            restriction.Enumerations.Add("restrictionEnum");

            attribute.Restriction = restriction;
            attribute.SpecialLength = false;
            attribute.Type = "DataType.String";
            attribute.Value = "baseAttribute";
            attribute.Documentation = "baseAttribute";
            attribute.IsAdvanced = true;

            NewRelic.AgentConfiguration.Parts.Attribute clone = attribute.Clone();

            if (attribute.Default != clone.Default)
            {
                Assert.Fail("Clone.Default does not match base.");
            }

            if (attribute.Use != clone.Use)
            {
                Assert.Fail("Clone.Use does not match base.");
            }

            if (attribute.Name != clone.Name)
            {
                Assert.Fail("Clone.Name does not match base.");
            }

            if (attribute.Parent != null)
            {
                if (attribute.Parent.Name != clone.Parent.Name)
                {
                    Assert.Fail("Clone.Parent does not match base.");
                }
            }
            else
            {
                if (clone.Parent != null)
                {
                    Assert.Fail("Clone.Parent not null, base is null");
                }
            }

            if (attribute.Restriction.Enumerations.Count != clone.Restriction.Enumerations.Count)
            {
                Assert.Fail("Clone.Restriction.Enumerations.Count does not match base.");
            }

            if (attribute.SpecialLength != clone.SpecialLength)
            {
                Assert.Fail("Clone.SpecialLength does not match base.");
            }

            if (attribute.Type != clone.Type)
            {
                Assert.Fail("Clone.Type does not match base.");
            }

            if (attribute.Documentation != clone.Documentation)
            {
                Assert.Fail("Clone.Documentation does not match base.");
            }

            if (attribute.IsAdvanced != clone.IsAdvanced)
            {
                Assert.Fail("Clone.IsAdvanced does not match base.");
            }

            if (attribute.Value == clone.Value)
            {
                Assert.Fail("Clone.Value matches base.");
            }
        }
Пример #9
0
        public void Clone_SuccessNoValue()
        {
            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Default = "baseDefault";
            attribute.Use     = "baseUse";
            attribute.Name    = "baseAttribute";
            attribute.Parent  = null;

            Restriction restriction = new Restriction();

            restriction.Enumerations.Add("restrictionEnum");

            attribute.Restriction   = restriction;
            attribute.SpecialLength = false;
            attribute.Type          = "DataType.String";
            attribute.Value         = "baseAttribute";
            attribute.Documentation = "baseAttribute";
            attribute.IsAdvanced    = true;

            NewRelic.AgentConfiguration.Parts.Attribute clone = attribute.Clone();

            if (attribute.Default != clone.Default)
            {
                Assert.Fail("Clone.Default does not match base.");
            }

            if (attribute.Use != clone.Use)
            {
                Assert.Fail("Clone.Use does not match base.");
            }

            if (attribute.Name != clone.Name)
            {
                Assert.Fail("Clone.Name does not match base.");
            }

            if (attribute.Parent != null)
            {
                if (attribute.Parent.Name != clone.Parent.Name)
                {
                    Assert.Fail("Clone.Parent does not match base.");
                }
            }
            else
            {
                if (clone.Parent != null)
                {
                    Assert.Fail("Clone.Parent not null, base is null");
                }
            }

            if (attribute.Restriction.Enumerations.Count != clone.Restriction.Enumerations.Count)
            {
                Assert.Fail("Clone.Restriction.Enumerations.Count does not match base.");
            }

            if (attribute.SpecialLength != clone.SpecialLength)
            {
                Assert.Fail("Clone.SpecialLength does not match base.");
            }

            if (attribute.Type != clone.Type)
            {
                Assert.Fail("Clone.Type does not match base.");
            }

            if (attribute.Documentation != clone.Documentation)
            {
                Assert.Fail("Clone.Documentation does not match base.");
            }

            if (attribute.IsAdvanced != clone.IsAdvanced)
            {
                Assert.Fail("Clone.IsAdvanced does not match base.");
            }

            if (attribute.Value == clone.Value)
            {
                Assert.Fail("Clone.Value matches base.");
            }
        }