Exemple #1
0
        /// <summary>
        /// Gets a settings object for a  <see cref="SqlReaderPlugin"/>.
        /// </summary>
        private SqlReaderPlugin CreateSqlReaderPlugin()
        {
            var p = new SqlReaderPlugin();

            // This is for LocalDB 2012. If you are using LocalDB 2014 change "v11.0" to "MSSQLLocalDB".
            p.ConnectionString = @"Server=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|database.mdf;Integrated Security=true;";

            // This is for full SQL Server.
            ////ConnectionString = @"Data Source=.;Integrated Security=true;Initial Catalog=Resizer;AttachDbFilename=|DataDirectory|database.mdf;",
            p.VirtualFilesystemPrefix = @"/databaseimages/";
            p.StripFileExtension      = true;
            p.ImageIdType             = System.Data.SqlDbType.UniqueIdentifier;
            p.ImageBlobQuery          = "SELECT Content FROM Images WHERE ImageID=@id";
            p.ModifiedDateQuery       = "Select ModifiedDate, CreatedDate From Images WHERE ImageID=@id";
            p.CacheUnmodifiedFiles    = true;
            p.RequireImageExtension   = false;
            p.LazyExistenceCheck      = true;


            if (Environment.GetEnvironmentVariable("APPVEYOR") == "True")
            {
                p.ConnectionString = @"Server=(local)\SQL2017;User ID=sa;Password=Password12!;Database=Resizer;";
            }

            return(p);
        }
Exemple #2
0
        public void NameValueConstructor()
        {
            // Arrange
            var settings = new NameValueCollection();

            // Act
            IVirtualImageProvider target = new SqlReaderPlugin(settings);

            // Assert
            Assert.NotNull(target);
            Assert.IsType <SqlReaderPlugin>(target);
        }