Ejemplo n.º 1
0
        public void ErrosCountTest(string configPath, string crozzlePath)
        {
            var configLoader = new ConfigurationLoader(new ConfigurationFileValidator());

            try
            {
                configLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + configPath);
            }
            catch
            {
                // ignored
            }
            var config        = configLoader.GetModel();
            var crozzleLoader = new CrozzleLoader(new CrozzleFileValidator()).SetConfig(config);

            try
            {
                crozzleLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + crozzlePath);
            }
            catch
            {
                // ignored
            }

            var crozzle = crozzleLoader.GetModel();

            Assert.Greater(crozzle.ValidationResult.ErrorsCount, 30);
        }
Ejemplo n.º 2
0
        public void ConfigLoadingSuccessTest()
        {
            var configLoader = new ConfigurationLoader(new ConfigurationFileValidator());

            Assert.DoesNotThrow(() => configLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\Configuration EASY.txt"));

            var config = configLoader.GetModel();

            Assert.AreEqual(config.PointPerLetters.Count, 52);
            Assert.AreEqual(config.PointsPerWord, 0);
            Assert.AreEqual(config.GrupsLimit, 1000);
        }
Ejemplo n.º 3
0
        public void CrozzleConstraintsPassTests()
        {
            var configLoader = new ConfigurationLoader(new ConfigurationFileValidator());

            Assert.DoesNotThrow(() => configLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\Configuration EASY.txt"));
            var config        = configLoader.GetModel();
            var crozzleLoader = new CrozzleLoader(new CrozzleFileValidator()).SetConfig(config);

            Assert.DoesNotThrow(() => crozzleLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\Test 1 - crozzle.txt"));
            var crozzle = crozzleLoader.GetModel();

            Assert.IsTrue(crozzle.ValidationResult.IsValid);
        }
Ejemplo n.º 4
0
        public void SerializeValidationResultInHtmlTest()
        {
            var configLoader = new ConfigurationLoader(new ConfigurationFileValidator());

            Assert.DoesNotThrow(() => configLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\Configuration EASY.txt"));
            var config        = configLoader.GetModel();
            var crozzleLoader = new CrozzleLoader(new CrozzleFileValidator()).SetConfig(config);

            Assert.DoesNotThrow(() => crozzleLoader.CreateModel(AppDomain.CurrentDomain.BaseDirectory + "\\Data\\Test 1 - crozzle.txt"));
            var crozzle = crozzleLoader.GetModel();

            var html = crozzle.SerializeToHtml();

            Console.WriteLine(html);
            Assert.IsTrue(!string.IsNullOrEmpty(html));
        }