public void TestPropertyCtor_EmptyPropertyName_ThrowsArgumentException() { // Arrange string propertyName = String.Empty; string propertyType = "int"; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType); }
public void TestPropertyCtor_NullPropertyName_ThrowsArgumentNullException() { // Arrange string propertyName = null; string propertyType = "int"; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType); }
public void TestPropertyTypeSetEmpty_FluentAPI_ThrowsArgumentException() { // Arrange string propertyName = "property"; string propertyType = "int"; string newPropertyType = String.Empty; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithPropertyType(newPropertyType); }
public void TestSetSetterAccessibilityLevelNull_FluentAPI_ThrowsArgumentNullException() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel setterAccessLevel = null; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithSetterAccessibilityLevel(setterAccessLevel); }
public void TestPropertyTypeSetNull_Property_ThrowsArgumentNullException() { // Arrange string propertyName = "property"; string propertyType = "int"; string newPropertyType = null; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property.PropertyType = newPropertyType; }
public void TestSetGetterAccessibilityLevelNull_Property_ThrowsArgumentNullException() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel getterAccessLevel = null; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property.GetterAccessibilityLevel = getterAccessLevel; }
public void TestPropertyTypeSetNull_WithSystemType_FluentAPI_ThrowsArgumentNullException() { // Arrange string propertyName = "property"; string propertyType = "int"; Type newPropertyType = null; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithPropertyType(newPropertyType); }
public void TestPropertyCtor_PropertyNameWithSpaces_ReplacedWithUnderscores() { // Arrange string propertyName = "Some Property Name"; string propertyType = "int"; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Assert Assert.AreEqual(propertyName.Replace(" ", "_"), property.PropertyName); }
public void TestAccessibilityLevelSetNull_FluentAPI_ThrowsArgumentNullException() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; SGAccessibilityLevel newAccessibilityLevel = null; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithAccessibilityLevel(newAccessibilityLevel); }
public void TestPropertyCtor_TypedPropertyType_InitsFields() { // Arrange string propertyName = "property"; Type propertyType = typeof(int); // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Assert Assert.AreEqual(propertyType.Name, property.PropertyType); }
public void TestSetSetterAccessibilityLevelNull_PropertyInitializer_ThrowsArgumentNullException() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel setterAccessLevel = null; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType) { SetterAccessibilityLevel = setterAccessLevel }; }
public void TestSetGetterAccessibilityLevel_Property() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel getterAccessLevel = SGAccessibilityLevel.Public; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property.GetterAccessibilityLevel = getterAccessLevel; // Assert Assert.AreEqual(getterAccessLevel, property.GetterAccessibilityLevel); }
public void TestPropertyNameSet() { // Arrange string propertyName = "property"; string propertyType = "int"; string newPropertyName = "newProperty"; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property.PropertyName = newPropertyName; // Assert Assert.AreEqual(newPropertyName, property.PropertyName); }
public void TestSetStaticFlag_PropertySetter() { // Arrange string propertyName = "property"; string propertyType = "int"; bool isStatic = true; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property.IsStatic = isStatic; // Assert Assert.IsTrue(isStatic); }
public void TestPropertyNameSet_WithSpaces_FluentAPI_ReplacedWithUnderscores() { // Arrange string propertyName = "property"; string propertyType = "int"; string newPropertyName = "Some Property Name"; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithPropertyName(newPropertyName); // Assert Assert.AreEqual(newPropertyName.Replace(" ", "_"), property.PropertyName); }
public void TestPropertyTypeSet_FluentAPI() { // Arrange string propertyName = "property"; string propertyType = "int"; string newPropertyType = "bool"; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithPropertyType(newPropertyType); // Assert Assert.AreEqual(newPropertyType, property.PropertyType); }
public void TestPropertyTypeSet_WithSystemType_FluentAPI() { // Arrange string propertyName = "property"; string propertyType = "int"; Type newPropertyType = typeof(bool); SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithPropertyType(newPropertyType); // Assert Assert.AreEqual(newPropertyType.Name, property.PropertyType); }
public void TestSetStaticFlag_FluentAPI() { // Arrange string propertyName = "property"; string propertyType = "int"; bool isStatic = true; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithIsStatic(isStatic); // Assert Assert.IsTrue(isStatic); }
public void TestSetInitializationValue_Int() { // Arrange string propertyName = "property"; string propertyType = "int"; int initializationValue = 5; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithInitializationValue(initializationValue); // Assert Assert.AreEqual("5", property.InitializationValue); }
public void TestSetInitializationValue_EmptyString() { // Arrange string propertyName = "property"; string propertyType = "int"; string initializationValue = String.Empty; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithInitializationValue(initializationValue); // Assert Assert.AreEqual($"\"\"", property.InitializationValue); }
public void TestSetInitializationValue_String() { // Arrange string propertyName = "property"; string propertyType = "int"; object initializationValue = "test string"; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithInitializationValue(initializationValue); // Assert Assert.AreEqual($"\"{initializationValue}\"", property.InitializationValue); }
public void TestSetInitializationValue_PropertySetter() { // Arrange string propertyName = "property"; string propertyType = "int"; string initializationValue = "5"; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property.InitializationValue = initializationValue; // Assert Assert.AreEqual(initializationValue, property.InitializationValue); }
public void TestSetInitializationValue_FluentAPI() { // Arrange string propertyName = "property"; string propertyType = "int"; object initializationValue = 5; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithInitializationValue(initializationValue); // Assert Assert.AreEqual(initializationValue.ToString(), property.InitializationValue); }
public void TestSetSetterAccessibilityLevel_FluentAPI() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel setterAccessLevel = SGAccessibilityLevel.Public; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithSetterAccessibilityLevel(setterAccessLevel); // Assert Assert.AreEqual(setterAccessLevel, property.SetterAccessibilityLevel); }
public void TestAccessibilityLevelSet_FluentAPI() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; SGAccessibilityLevel newAccessibilityLevel = SGAccessibilityLevel.Protected; SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Act property = property.WithAccessibilityLevel(newAccessibilityLevel); // Assert Assert.AreEqual(newAccessibilityLevel, property.AccessibilityLevel); }
public void TestAccessibilityLevelSet_PropertyInitializer() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType) { AccessibilityLevel = accessibilityLevel }; // Assert Assert.AreEqual(accessibilityLevel, property.AccessibilityLevel); }
public void TestSetStaticFlag_PropertyInitializer() { // Arrange string propertyName = "property"; string propertyType = "int"; bool isStatic = true; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType) { IsStatic = isStatic }; // Assert Assert.IsTrue(isStatic); }
public void TestSetSetterAccessibilityLevel_PropertyInitializer() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel setterAccessLevel = SGAccessibilityLevel.Public; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType) { SetterAccessibilityLevel = setterAccessLevel }; // Assert Assert.AreEqual(setterAccessLevel, property.SetterAccessibilityLevel); }
public void TestPropertyCtor_Defaults_InitsFields() { // Arrange string propertyName = "property"; string propertyType = "int"; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType); // Assert Assert.AreEqual(propertyName, property.PropertyName); Assert.AreEqual(propertyType, property.PropertyType); Assert.AreEqual(SGAccessibilityLevel.Private, property.AccessibilityLevel); Assert.IsFalse(property.IsStatic); Assert.AreEqual(SGAccessibilityLevel.None, property.GetterAccessibilityLevel); Assert.AreEqual(SGAccessibilityLevel.None, property.SetterAccessibilityLevel); }
public void TestPropertyCtor_InitsFields() { // Arrange string propertyName = "property"; string propertyType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; bool @static = true; SGAccessibilityLevel getterAccessibilityLevel = SGAccessibilityLevel.Protected; SGAccessibilityLevel setterAccessibilityLevel = SGAccessibilityLevel.Internal; // Act SGClassProperty property = new SGClassProperty(propertyName, propertyType, accessibilityLevel, @static, getterAccessibilityLevel, setterAccessibilityLevel); // Assert Assert.AreEqual(propertyName, property.PropertyName); Assert.AreEqual(propertyType, property.PropertyType); Assert.AreEqual(accessibilityLevel, property.AccessibilityLevel); Assert.AreEqual(@static, property.IsStatic); Assert.AreEqual(getterAccessibilityLevel, property.GetterAccessibilityLevel); Assert.AreEqual(setterAccessibilityLevel, property.SetterAccessibilityLevel); }