public void CreateAttributeFromClassWrongName()
        {
            NhvmClassAttributename attributename = new NhvmClassAttributename();

            attributename.Text = new string[] { "assertanimal" };
            Assert.That(() => RuleAttributeFactory.CreateAttributeFromClass(typeof(Suricato), attributename), Throws.TypeOf <InvalidAttributeNameException>());
        }
Example #2
0
 private static string GetText(NhvmClassAttributename attributename)
 {
     string[] text = attributename.Text;
     if (text != null)
     {
         string result = string.Join(System.Environment.NewLine, text).Trim();
         return(result.Length == 0 ? null : result);
     }
     else
     {
         return(null);
     }
 }
        public void CreateAttributeFromClass()
        {
            NhvmClassAttributename attributename = new NhvmClassAttributename();

            attributename.Text = new string[] { "AssertAnimal" };
            Attribute found = RuleAttributeFactory.CreateAttributeFromClass(typeof(Suricato), attributename);

            Assert.IsNotNull(found);
            Assert.AreEqual(typeof(AssertAnimalAttribute), found.GetType());

            attributename.Text = new string[] { "AssertAnimalAttribute" };
            found = RuleAttributeFactory.CreateAttributeFromClass(typeof(Suricato), attributename);
            Assert.IsNotNull(found);
            Assert.AreEqual(typeof(AssertAnimalAttribute), found.GetType());
        }