Ejemplo n.º 1
0
 public ConfigManager()
 {
     AddSetting("Name", _className = new StringConfigSetting()
     {
         DefaultValue = "Scanner"
     });
     AddSetting("Namespace", _classNamespace = new StringConfigSetting()
     {
         DefaultValue = "Unspecified"
     });
     AddSetting("Visibility", _visibility = new EnumConfigSetting <ClassVisibility>("visibility")
     {
         DefaultValue = ClassVisibility.Default
     });
     AddSetting("ElementSize", _elementSize = new EnumConfigSetting <TableElementSize>("element size")
     {
         DefaultValue = TableElementSize.Default
     });
     AddSetting("TableCompression", _tableCompression = new EnumConfigSetting <Compression>("mode")
     {
         DefaultValue = Compression.Auto
     });
     AddSetting("CacheTables", _cacheTables = new BoolConfigSetting());
     AddSetting("SuppressTableEmbedding", _suppressTableEmbedding = new BoolConfigSetting());
     AddSetting("RenderScanGraph", _renderScanGraph = new EnumConfigSetting <GraphStyle>("style")
     {
         DefaultValue = GraphStyle.Default
     });
 }
Ejemplo n.º 2
0
        public void Reset()
        {
            var setting = new EnumConfigSetting <Blaticus>(string.Empty);

            setting.DefaultValue = Blaticus.Delta;

            Assert.That(setting.Value, Is.EqualTo(Blaticus.Alpha));

            setting.Reset();
            Assert.That(setting.Value, Is.EqualTo(Blaticus.Delta));
        }
Ejemplo n.º 3
0
        public void SetValidValue()
        {
            var setting = new EnumConfigSetting <Blaticus>("description");

            var reporter = new Mock <IErrorReporter>(MockBehavior.Strict);
            var token    = new Mock <IToken>(MockBehavior.Strict);

            token.Setup(x => x.Type).Returns(SettingTokenType.Label);
            token.Setup(x => x.Text).Returns("Gamma");

            setting.Set(reporter.Object, token.Object);

            Assert.That(setting.Value, Is.EqualTo(Blaticus.Gamma));
        }
Ejemplo n.º 4
0
        public void SetInvalidType()
        {
            var setting = new EnumConfigSetting <Blaticus>("description");

            var reporter = new Mock <IErrorReporter>(MockBehavior.Strict);
            var token    = new Mock <IToken>(MockBehavior.Strict);

            token.Setup(x => x.Type).Returns(SettingTokenType.String);
            token.Setup(x => x.Text).Returns("Alpha");
            token.Setup(x => x.FromPos).Returns(new CharPos(10, 11, 12));
            token.Setup(x => x.ToPos).Returns(new CharPos(13, 14, 15));

            reporter.Setup(x => x.AddError(11, 12, 14, 15, "\"Alpha\" is not a valid description.")).Verifiable();
            setting.Set(reporter.Object, token.Object);
            Assert.That(setting.Value, Is.EqualTo(Blaticus.Alpha));
            reporter.Verify();
        }
Ejemplo n.º 5
0
 public ConfigManager()
 {
     AddSetting("Name", _parserName = new StringConfigSetting()
     {
         DefaultValue = "Parser"
     });
     AddSetting("TypeName", _typeName        = new StringConfigSetting());
     AddSetting("Namespace", _classNamespace = new StringConfigSetting()
     {
         DefaultValue = "Unspecified"
     });
     AddSetting("Visibility", _visibility = new EnumConfigSetting <ClassVisibility>("visibility")
     {
         DefaultValue = ClassVisibility.Default
     });
     AddSetting("TypeVisibility", _typeVisibility = new EnumConfigSetting <ClassVisibility>("visibility")
     {
         DefaultValue = ClassVisibility.Default
     });
     AddSetting("ElementSize", _elementSize = new EnumConfigSetting <TableElementSize>("element size")
     {
         DefaultValue = TableElementSize.Default
     });
     AddSetting("TableCompression", _tableCompression = new EnumConfigSetting <Compression>("mode")
     {
         DefaultValue = Compression.Auto
     });
     AddSetting("TypeHandling", _typeHandling = new EnumConfigSetting <TypeHandling>("mode")
     {
         DefaultValue = TypeHandling.Default
     });
     AddSetting("RenderParseTable", _renderParseTable = new BoolConfigSetting());
     AddSetting("RenderParseGraph", _renderParseGraph = new EnumConfigSetting <GraphStyle>("style")
     {
         DefaultValue = GraphStyle.Default
     });
     AddSetting("Trace", _trace             = new BoolConfigSetting());
     AddSetting("CacheTables", _cacheTables = new BoolConfigSetting());
     AddSetting("SuppressTableEmbedding", _suppressTableEmbedding = new BoolConfigSetting());
     AddSetting("TrimParseGraph", _trimParseGraph = new BoolConfigSetting()
     {
         DefaultValue = true
     });
     AddSetting("TokenType", _tokenType = new LabelConfigSetting());
 }