コード例 #1
0
        public void NArgAttribute_ProtectedCopyConstructorWorkWithValidValues_DoesNotThrow()
        {
            object nattr =
                CustomAttributeHelper.GetCustomPropertiesFromMember <AttributeTests, NArgAttribute>(
                    "NArgAttribute_ProtectedCopyConstructorWorkWithValidValues_DoesNotThrow");

            GoodInheritFromNArgAttribute good = new GoodInheritFromNArgAttribute((NArgAttribute)nattr);

            Assert.That(good.AltName, Is.EqualTo("somethingelse"));
            Assert.That(good.IsOptional, Is.True);
            Assert.That(good.Rank, Is.EqualTo(5));
            Assert.That(good.AllowedValues, Is.EqualTo(new string[] { "1", "2", "3" }));
            Assert.That(good.OptionalArgName, Is.EqualTo("avalue"));
        }
コード例 #2
0
 public void NArgAttribute_CanSetAltNamePropertyOnAPropertyMember_IsBar()
 {
     Assert.That(CustomAttributeHelper.GetCustomPropertiesFromMember <Sample, NArgAttribute>("Foo"), Has.Property("AltName").EqualTo("Bar"));
 }
コード例 #3
0
        public void MemberAttribute_WhenOptionalSetWithAllowedValuesAndOptionalArgNameNotSet_HasOptionalArgumentIsTrue()
        {
            NArgAttribute nattr = (NArgAttribute)CustomAttributeHelper.GetCustomPropertiesFromMember <Sample, NArgAttribute>("_limitedValues");

            Assert.That(nattr.HasOptionalArgument, Is.True);
        }
コード例 #4
0
 public void NArgAttribute_CanSetRankPropertyOnADataMember_Is7()
 {
     Assert.That(CustomAttributeHelper.GetCustomPropertiesFromMember <Sample, NArgAttribute>("_one"), Has.Property("Rank").EqualTo(7));
 }