public void RepositoryFactoryConfigurationCreateWithDefaults()
        {
            RepositoryElement  defaultConfig = new RepositoryElement();
            IRepositoryFactory factory       = new ConfigurationRepositoryFactory(defaultConfig.RepositoryType, defaultConfig.ConnectionStringName);
            IRepository        repository    = factory.Create();

            Assert.IsNotNull(repository);
            Assert.IsInstanceOfType(repository, typeof(SQLiteRepository));
        }
        public void RepositoryFactoryConfigurationCreateWithSpecified()
        {
            IRepositoryFactory factory    = new ConfigurationRepositoryFactory("BlueCollar.Test.TestNoOpRepository, BlueCollar.Test", "TestNoOpRepository");
            IRepository        repository = factory.Create();

            Assert.IsNotNull(repository);
            Assert.IsInstanceOfType(repository, typeof(TestNoOpRepository));
            Assert.AreEqual(ConfigurationManager.ConnectionStrings["TestNoOpRepository"].ConnectionString, ((TestNoOpRepository)repository).ConnectionString);
        }
        protected ActionResult Get <T>() where T : IPageViewModel, new()
        {
            T model = new T();

            using (IRepository repository = new ConfigurationRepositoryFactory().Create())
            {
                if (model.Fill(repository, ModelState))
                {
                    return(View(model));
                }
            }

            return(Throw404Result());
        }
        public void RepositoryFactoryConfigurationFailCreateNotAnIRepository()
        {
            IRepositoryFactory factory = new ConfigurationRepositoryFactory("BlueCollar.Test.RepositoryFactoryTests, BlueCollar.Test", null);

            factory.Create();
        }
        public void RepositoryFactoryConfigurationFailCreateWithMissingConnectionString()
        {
            IRepositoryFactory factory = new ConfigurationRepositoryFactory("BlueCollar.Test.TestNoOpRepository, BlueCollar.Test", "NotAConnectionStringName");

            factory.Create();
        }