コード例 #1
0
        public Given_an_OdcmClass_Entity_Property_forced_to_pascal_case()
        {
            SetConfiguration(new CSharpWriterSettings
            {
                ForcePropertyPascalCasing = true
            });

            Init(m =>
            {
                var originalProperty = Class.Properties.Where(p => !p.IsCollection).RandomElement();

                var camelCasedName = Any.Char('a', 'z') + originalProperty.Name;

                _property = originalProperty.Rename(camelCasedName);

                originalProperty = Class.NavigationProperties().Where(p => p.IsCollection).RandomElement();

                camelCasedName = Any.Char('a', 'z') + originalProperty.Name;

                _collectionProperty = originalProperty.Rename(camelCasedName);
            });

            _propertyType = Proxy.GetClass(_property.Type.Namespace, _property.Type.Name);

            _collectionPropertyType = Proxy.GetClass(_collectionProperty.Type.Namespace, _collectionProperty.Type.Name);
            _collectionPropertyType = typeof(IList <>).MakeGenericType(_collectionPropertyType);
        }
        public Given_an_OdcmClass_Service_Property_forced_to_pascal_case()
        {
            SetConfiguration(new CSharpWriterSettings
            {
                ForcePropertyPascalCasing = true
            });

            base.Init(m =>
            {
                _property = Model.EntityContainer.Properties.RandomElement();

                _property = _property.Rename(Any.Char('a', 'z') + _property.Name);
            });
        }
コード例 #3
0
        public void ShouldOutputBlankCharWhenEvaluatedForArrayThatDoesNotContainTrigger()
        {
            //GIVEN
            var onTrigger     = Any.Char();
            var fallbackValue = Any.String();
            var fallback      = Substitute.For <Displayable>();
            var inputTriggers = Any.ArrayWithout(onTrigger);
            var segment       = new SwitchableSegment(onTrigger, Any.String(), fallback);

            fallback.Evaluate(inputTriggers).Returns(fallbackValue);

            //WHEN
            var result = segment.Evaluate(inputTriggers);

            //THEN
            XAssert.Equal(fallbackValue, result);
        }
コード例 #4
0
        public void ShouldOutputOnValueWhenEvaluatedForArrayThatContainsTrigger()
        {
            //GIVEN
            var onTrigger     = Any.Char();
            var onValue       = Any.String();
            var inputTriggers = Any.ArrayWith(onTrigger);
            var fallback      = Substitute.For <Displayable>();
            var segment       = new SwitchableSegment(onTrigger, onValue, new BlankSpace());

            fallback.Evaluate(inputTriggers).Returns(Any.StringOtherThan(onValue));

            //WHEN
            var result = segment.Evaluate(inputTriggers);

            //THEN
            XAssert.Equal(onValue, result);
        }
        public Given_an_OdcmClass_Entity_Navigation_Property_Instance_forced_to_pascal_case()
        {
            SetConfiguration(new CSharpWriterSettings
            {
                ForcePropertyPascalCasing = true
            });

            Init(m =>
            {
                _camelCasedProperty = Class.NavigationProperties().Where(p => !p.IsCollection).RandomElement();

                _camelCasedName = Any.Char('a', 'z') + _camelCasedProperty.Name;

                _camelCasedProperty = _camelCasedProperty.Rename(_camelCasedName);
            });

            _pascalCasedName = _camelCasedName.ToPascalCase();
        }
コード例 #6
0
        public Given_an_OdcmClass_Entity_Navigation_Property_Key_forced_to_pascal_case()
        {
            SetConfiguration(new CSharpWriterSettings
            {
                ForcePropertyPascalCasing = true
            });

            Init(m =>
            {
                var property = Class.Key.RandomElement();

                _camelCasedName = Any.Char('a', 'z') + property.Name;

                property.Rename(_camelCasedName);
            });

            _pascalCasedName = _camelCasedName.ToPascalCase();
        }
コード例 #7
0
        public void PlainGenerators()
        {
            Any.Integer();
            Any.Instance <int>();

            Any.DateTime();
            Any.Instance <DateTime>();

            Any.Boolean();
            Any.Instance <bool>();

            Any.Char();
            Any.Instance <char>();

            //...etc

            Any.Uri();
            Any.IpAddress();
            //...
        }
コード例 #8
0
        public Given_an_OdcmClass_Complex_Property_forced_to_pascal_case()
        {
            SetConfiguration(new CSharpWriterSettings
            {
                ForcePropertyPascalCasing = true
            });

            base.Init(m =>
            {
                _targetClass = Any.ComplexOdcmClass(Namespace);

                m.AddType(_targetClass);

                _property = _targetClass.Properties.RandomElement();

                _property = _property.Rename(Any.Char('a', 'z') + _property.Name);
            });

            _targetType = Proxy.GetClass(_targetClass.Namespace, _targetClass.Name);
        }