public void CreateBackingFieldEdgeCaseTest() { const string name = "TestProperty"; CodeTypeReference type = new CodeTypeReference(typeof(object)); string[] usedWords = new string[] { }; Assert.Throws <ArgumentNullException>(() => DecoratorUtil.CreateBackingField(null, type, usedWords)); Assert.Throws <ArgumentNullException>(() => DecoratorUtil.CreateBackingField(name, null, usedWords)); Assert.Throws <ArgumentNullException>(() => DecoratorUtil.CreateBackingField(name, type, null)); }
public void CreateBackingFieldTest() { const string name = "TestProperty"; CodeTypeReference type = new CodeTypeReference(typeof(bool)); string[] usedWords = new string[] { }; CodeMemberField field = DecoratorUtil.CreateBackingField(name, type, usedWords); Assert.IsNotNull(field); Assert.That(field.Name, Is.EqualTo("_TestProperty")); Assert.That(field.Type.BaseType, Is.EqualTo(typeof(bool).FullName)); Assert.That(field.Attributes, Is.EqualTo(MemberAttributes.Private)); }