Ejemplo n.º 1
0
        public void TestAccessibilityLevelSetNull_FluentAPI_ThrowsArgumentNullException()
        {
            // Arrange
            string methodName = "Method";
            SGAccessibilityLevel accessibilityLevel = null;

            // Act
            SGMethodSignature method = new SGMethodSignature(methodName).WithAccessibilityLevel(accessibilityLevel);
        }
Ejemplo n.º 2
0
        public void TestEmptyInterfaceName_ThrowsArgumentException()
        {
            // Arrange
            string interfaceName = String.Empty;
            SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public;

            // Act
            SGInterface @interface = new SGInterface(accessibilityLevel, interfaceName);
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public void TestAccessibilityLevelSetNull_Property_ThrowsArgumentNullException()
        {
            // Arrange
            string methodName = "Method";
            SGAccessibilityLevel accessibilityLevel    = SGAccessibilityLevel.Public;
            SGAccessibilityLevel newAccessibilityLevel = null;
            SGMethodSignature    method = new SGMethodSignature(methodName, accessibilityLevel);

            // Act
            method.AccessibilityLevel = newAccessibilityLevel;
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public void TestAccessibilityLevelSet_FluentAPI()
        {
            // Arrange
            string methodName = "Method";
            SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public;

            // Act
            SGMethodSignature method = new SGMethodSignature(methodName).WithAccessibilityLevel(accessibilityLevel);

            // Assert
            Assert.AreEqual(accessibilityLevel, method.AccessibilityLevel);
        }
Ejemplo n.º 9
0
        public void TestInterfaceCtor_NameAccessibility_InitsFields()
        {
            // Arrange
            string interfaceName = "IInterface";
            SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public;

            // Act
            SGInterface @interface = new SGInterface(accessibilityLevel, interfaceName);

            // Assert
            Assert.AreEqual(interfaceName, @interface.InterfaceName);
            Assert.AreEqual(accessibilityLevel, @interface.AccessibilityLevel);
        }
Ejemplo n.º 10
0
        public void TestAccessibilityLevelSetNull_PropertyInitializer_ThrowsArgumentNullException()
        {
            // Arrange
            string fieldName = "field";
            string fieldType = "int";
            SGAccessibilityLevel accessibilityLevel = null;

            // Act
            SGClassField field = new SGClassField(fieldName, fieldType)
            {
                AccessibilityLevel = accessibilityLevel
            };
        }
Ejemplo n.º 11
0
        public void TestSetSetterAccessibilityLevelNull_PropertyInitializer_ThrowsArgumentNullException()
        {
            // Arrange
            string propertyName = "property";
            string propertyType = "int";
            SGAccessibilityLevel setterAccessLevel = null;

            // Act
            SGClassProperty property = new SGClassProperty(propertyName, propertyType)
            {
                SetterAccessibilityLevel = setterAccessLevel
            };
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        public void TestAccessibilityLevelSet_Property()
        {
            // Arrange
            string methodName = "Method";
            SGAccessibilityLevel accessibilityLevel    = SGAccessibilityLevel.Public;
            SGAccessibilityLevel newAccessibilityLevel = SGAccessibilityLevel.Protected;
            SGMethodSignature    method = new SGMethodSignature(methodName, accessibilityLevel);

            // Act
            method.AccessibilityLevel = newAccessibilityLevel;

            // Assert
            Assert.AreEqual(newAccessibilityLevel, method.AccessibilityLevel);
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        public void TestMethodCtor_All_with_TypedReturnType_InitsFields()
        {
            // Arrange
            string methodName = "Method";
            SGAccessibilityLevel accessibilityLevel = SGAccessibilityLevel.Public;
            Type returnType = typeof(int);
            bool @static    = true;
            bool @async     = true;
            bool @override  = true;

            // Act
            SGMethodSignature method = new SGMethodSignature(methodName, returnType, accessibilityLevel, @static, @async, @override);

            // Assert
            Assert.AreEqual(methodName, method.MethodName);
            Assert.AreEqual(accessibilityLevel, method.AccessibilityLevel);
            Assert.AreEqual(returnType.Name, method.ReturnType);
            Assert.AreEqual(@static, method.IsStatic);
            Assert.AreEqual(async, method.IsAsync);
            Assert.AreEqual(@override, method.IsOverride);
        }
Ejemplo n.º 22
0
        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);
        }