public void EmptyDataTest() { var generator = new AttributeGenerator(); var result = generator.Generate(new Type[0]); Assert.AreEqual("", result); }
public void SingleAttributeTypeDataTest() { var generator = new AttributeGenerator(); var attributes = new[] { typeof(System.ComponentModel.DataAnnotations.RequiredAttribute) }; var result = generator.Generate(attributes); Assert.AreEqual("[System.ComponentModel.DataAnnotations.RequiredAttribute]", result); }
public void Generate_GivenCustomAttributeData_WithoutNamedArgument_GenerateAttributeAsString() { var stringAttribute = _sut.Generate(typeof(AttributeHost).GetCustomAttributesData().First()); Assert.Equal("[RequestHandlers.Mvc.Tests.CSharp.TestNamedArgumentsAttribute]", stringAttribute); }
public void InvalidDataTypeTest() { var generator = new AttributeGenerator(); Assert.Throws(typeof(InvalidOperationException), () => generator.Generate(123)); }
public void NullDataTest() { var generator = new AttributeGenerator(); Assert.Throws(typeof(ArgumentNullException), () => generator.Generate(null)); }
public string LiteralDataTest(string data) { var generator = new AttributeGenerator(); return(generator.Generate(data)); }