chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi, I wonder whether Attributes verification will be supported in the future release?

for example, I want to check
        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult Index()
        {
   
            return View();
        }
      


Has the correct attribute ( AcceptVerbs) attached to it. That would be tremendously useful in developing ASP.NET MVC applications because a lot of the pre-action execution and post-action execution can be verified in that way.
________
Honda L700 history
asked by nsoonhui (59.1k points)

2 Answers

0 votes
Hi,

It could be a very interesting and helpful feature. I will add it to our future plans.

In the meantime I recommend using reflection in your unit tests to query the function's metadata and check if a certain attribute is attached to it

Update - It seems that NUnit 2.5 has a new feature that does exactly that:

[Serializable]
public class testclass {}

[Test]
public void Test()
{ 
Assert.That(new testclass(), Has.Attribute<SerializableAttribute>()); 
}
answered by dhelper (11.9k points)
0 votes
Hi,

It could be a very interesting and helpful feature. I will add it to our future plans.

In the meantime I recommend using reflection in your unit tests to query the function's metadata and check if a certain attribute is attached to it

Update - It seems that NUnit 2.5 has a new feature that does exactly that:

[Serializable]
public class testclass {}

[Test]
public void Test()
{ 
Assert.That(new testclass(), Has.Attribute<SerializableAttribute>()); 
}


thanks! That seems to be exactly what I need
________
Chevrolet Sequel
answered by nsoonhui (59.1k points)
...