public void TestAccessibilityLevelSetNull_FluentAPI_ThrowsArgumentNullException()
        {
            // Arrange
            string methodName = "Method";
            SGAccessibilityLevel accessibilityLevel = null;

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

            // Act
            SGInterface @interface = new SGInterface(accessibilityLevel, interfaceName);
        }
Example #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;
        }
Example #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);
        }
        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;
        }
Example #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);
        }
Example #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);
        }
        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);
        }
Example #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);
        }
Example #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
            };
        }
Example #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
            };
        }
Example #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);
        }
        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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
        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);
        }
Example #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);
        }