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); }
/// <summary> /// Sample IoC container /// </summary> /// <returns>Configured form for running</returns> private static Form Configure() { var crozzleFileValidator = new CrozzleFileValidator(); var configFileValidator = new ConfigurationFileValidator(); var crozzleLoader = new CrozzleLoader(crozzleFileValidator); var configLoader = new ConfigurationLoader(configFileValidator); var presenter = new MainPresenter(crozzleLoader, configLoader); return(new MainForm(presenter)); }
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); }
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)); }