public void TestFieldCtor_EmptyFieldName_ThrowsArgumentException() { // Arrange string fieldName = String.Empty; string fieldType = "int"; // Act SGClassField field = new SGClassField(fieldName, fieldType); }
public void TestFieldCtor_NullFieldName_ThrowsArgumentNullException() { // Arrange string fieldName = null; string fieldType = "int"; // Act SGClassField field = new SGClassField(fieldName, fieldType); }
public void TestTypeValueSetNull_WithSystemType_FluentAPI_ThrowsArgumentNullException() { // Arrange string fieldName = "field"; string fieldType = "int"; Type newFieldType = null; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithTypeValue(newFieldType); }
public void TestTypevalueSetEmpty_Property_ThrowsArgumentException() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldType = String.Empty; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.FieldType = newFieldType; }
public void TestTypeValueSetNull_Property_ThrowsArgumentNullException() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldType = null; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.FieldType = newFieldType; }
public void TestFieldNameSetNull_FluentAPI_ThrowsArgumentNullException() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldName = null; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithFieldName(newFieldName); }
public void TestTypevalueSetEmpty_FluentAPI_ThrowsArgumentException() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldType = String.Empty; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithTypeValue(newFieldType); }
public void TestAccessibilityLevelSetNull_FluentAPI_ThrowsArgumentNullException() { // Arrange string fieldName = "field"; string fieldType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; SGAccessibilityLevel newAccessibilityLevel = null; SGClassField field = new SGClassField(fieldName, fieldType, accessibilityLevel); // Act field = field.WithAccessibilityLevel(newAccessibilityLevel); }
public void TestFieldCtor_FieldNameWithSpaces_ReplacedWithUnderscores() { // Arrange string fieldName = "Some Field Name"; string fieldType = "int"; // Act SGClassField field = new SGClassField(fieldName, fieldType); // Assert Assert.AreEqual(fieldName.Replace(" ", "_"), field.FieldName); }
public void TestFieldCtor_TypedFieldType_InitsFields() { // Arrange string fieldName = "field"; Type fieldType = typeof(int); // Act SGClassField field = new SGClassField(fieldName, fieldType); // Assert Assert.AreEqual(fieldType.Name, field.FieldType); }
public void TestAccessibilityLevelSetNull_PropertyInitializer_ThrowsArgumentNullException() { // Arrange string fieldName = "field"; string fieldType = "int"; SGAccessibilityLevel accessibilityLevel = null; // Act SGClassField field = new SGClassField(fieldName, fieldType) { AccessibilityLevel = accessibilityLevel }; }
public void TestSetConstFlag_PropertySetter() { // Arrange string fieldName = "field"; string fieldType = "int"; bool isConst = true; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.IsConst = isConst; // Assert Assert.IsTrue(field.IsConst); }
public void TestTypeValueSet_WithSystemType_FluentAPI() { // Arrange string fieldName = "field"; string fieldType = "int"; Type newFieldType = typeof(bool); SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithTypeValue(newFieldType); // Assert Assert.AreEqual(newFieldType.Name, field.FieldType); }
public void TestFieldNameSet_WithSpaces_FluentAPI_ReplacedWithUnderscores() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldName = "some New Field Name"; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithFieldName(newFieldName); // Assert Assert.AreEqual(newFieldName.Replace(" ", "_"), field.FieldName); }
public void TestSetInitializationValue_Int() { // Arrange string fieldName = "field"; string fieldType = "int"; int initializationValue = 5; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithInitializationValue(initializationValue); // Assert Assert.AreEqual("5", field.InitializationValue); }
public void TestSetInitializationValue_EmptyString() { // Arrange string fieldName = "field"; string fieldType = "int"; string initializationValue = String.Empty; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithInitializationValue(initializationValue); // Assert Assert.AreEqual($"\"\"", field.InitializationValue); }
public void TestSetInitializationValue_FluentAPI() { // Arrange string fieldName = "field"; string fieldType = "int"; object initializationValue = 5; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithInitializationValue(initializationValue); // Assert Assert.AreEqual(initializationValue.ToString(), field.InitializationValue); }
public void TestTypeValueSet_FluentAPI() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldType = "bool"; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithTypeValue(newFieldType); // Assert Assert.AreEqual(newFieldType, field.FieldType); }
public void TestSetReadonlyFlag_FluentAPI() { // Arrange string fieldName = "field"; string fieldType = "int"; bool isReadonly = true; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithIsReadonly(isReadonly); // Assert Assert.IsTrue(field.IsReadonly); }
public void TestSetInitializationValue_PropertySetter() { // Arrange string fieldName = "field"; string fieldType = "int"; string initializationValue = "5"; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.InitializationValue = initializationValue; // Assert Assert.AreEqual(initializationValue, field.InitializationValue); }
public void TestSetStaticFlag_FluentAPI() { // Arrange string fieldName = "field"; string fieldType = "int"; bool isStatic = true; SGClassField field = new SGClassField(fieldName, fieldType); // Act field = field.WithIsStatic(isStatic); // Assert Assert.IsTrue(field.IsStatic); }
public void TestSetReadonlyFlag_PropertySetter() { // Arrange string fieldName = "field"; string fieldType = "int"; bool isReadonly = true; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.IsReadonly = isReadonly; // Assert Assert.IsTrue(field.IsReadonly); }
public void TestSetStaticFlag_PropertySetter() { // Arrange string fieldName = "field"; string fieldType = "int"; bool isStatic = true; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.IsStatic = isStatic; // Assert Assert.IsTrue(field.IsStatic); }
public void TestFieldNameSet() { // Arrange string fieldName = "field"; string fieldType = "int"; string newFieldName = "newField"; SGClassField field = new SGClassField(fieldName, fieldType); // Act field.FieldName = newFieldName; // Assert Assert.AreEqual(newFieldName, field.FieldName); }
public void TestAccessibilityLevelSet_FluentAPI() { // Arrange string fieldName = "field"; string fieldType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; SGAccessibilityLevel newAccessibilityLevel = SGAccessibilityLevel.Protected; SGClassField field = new SGClassField(fieldName, fieldType, accessibilityLevel); // Act field = field.WithAccessibilityLevel(newAccessibilityLevel); // Assert Assert.AreEqual(newAccessibilityLevel, field.AccessibilityLevel); }
public void TestAccessibilityLevelSet_PropertyInitializer() { // Arrange string fieldName = "field"; string fieldType = "int"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; // Act SGClassField field = new SGClassField(fieldName, fieldType) { AccessibilityLevel = accessibilityLevel }; // Assert Assert.AreEqual(accessibilityLevel, field.AccessibilityLevel); }
public void TestFieldCtor_Defaults_InitsFields() { // Arrange string fieldName = "field"; string fieldType = "int"; // Act SGClassField field = new SGClassField(fieldName, fieldType); // Assert Assert.AreEqual(fieldName, field.FieldName); Assert.AreEqual(fieldType, field.FieldType); Assert.AreEqual(SGAccessibilityLevel.Private, field.AccessibilityLevel); Assert.IsFalse(field.IsStatic); Assert.IsFalse(field.IsConst); Assert.IsFalse(field.IsReadonly); }
public void TestFieldCtor_InitsFields() { // Arrange string fieldName = "field"; SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public; string fieldType = "int"; bool @static = true; bool @const = true; bool @readonly = true; // Act SGClassField field = new SGClassField(fieldName, fieldType, accessibilityLevel, @static, @const, @readonly); // Assert Assert.AreEqual(fieldName, field.FieldName); Assert.AreEqual(accessibilityLevel, field.AccessibilityLevel); Assert.AreEqual(fieldType, field.FieldType); Assert.AreEqual(@static, field.IsStatic); Assert.AreEqual(@const, field.IsConst); Assert.AreEqual(@readonly, field.IsReadonly); }