Example #1
0
        public void NumWeatherTest()
        {
            _db = new ParkGeekDAO("Data Source=localhost\\sqlexpress;Initial Catalog=NPGeekTest;Integrated Security=True");
            var numWeather = _db.GetFiveDayWeather("CVNP");

            Assert.AreEqual(5, numWeather.Count);
        }
Example #2
0
 public ParkController(IUserSecurityDAO db, IParkGeekDAO parkDAO, IWeatherDAO weatherDAO, ISurveyResultDAO surveyDAO, IHttpContextAccessor httpContext) : base(db, httpContext)
 {
     _parkDAO      = parkDAO;
     _weatherDAO   = weatherDAO;
     _surveyDAO    = surveyDAO;
     _userSecurity = db;
 }
Example #3
0
        public void NumParksTests()
        {
            _db = new ParkGeekDAO("Data Source=localhost\\sqlexpress;Initial Catalog=NPGeekTest;Integrated Security=True");
            var numParks = _db.GetAllParks();

            Assert.AreEqual(10, numParks.Count);
        }
Example #4
0
        public void GetWeatherTest()
        {
            _db = new ParkGeekDAO("Data Source=localhost\\sqlexpress;Initial Catalog=NPGeekTest;Integrated Security=True");
            var weather = _db.GetFiveDayWeather("CVNP");

            Assert.AreEqual(38, weather[0].LowTemp);
            Assert.AreEqual(62, weather[0].HighTemp);
            Assert.AreEqual("rain", weather[0].Forecast);
        }
        /// <summary>
        /// Helper method for initializing database tests. Creates
        /// configuration object from json file and instance of
        /// ParkGeekSqlDAO
        /// </summary>
        /// <seealso cref="ParkGeekSqlDAO.ParkGeekSqlDAO(string)"/>
        public void CreateDAO()
        {
            IConfigurationBuilder builder = new ConfigurationBuilder().
                                            SetBasePath(Directory.GetCurrentDirectory()).
                                            AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
            IConfigurationRoot configuration = builder.Build();

            _connectionString = configuration.GetConnectionString("NPGeek");

            _dao = new ParkGeekSqlDAO(_connectionString);
            // this._dao = new ParkGeekSqlDAO(_connectionString);
        }
Example #6
0
        public void GetParkTest()
        {
            _db = new ParkGeekDAO("Data Source=localhost\\sqlexpress;Initial Catalog=NPGeekTest;Integrated Security=True");
            var testPark = _db.GetPark("CVNP");

            Assert.AreEqual("Cuyahoga Valley National Park", testPark.ParkName);
            Assert.AreEqual("Ohio", testPark.State);
            Assert.AreEqual(32832, testPark.Acreage);
            Assert.AreEqual(696, testPark.ElevationInFeet);
            Assert.AreEqual(125, testPark.MilesOfTrail);
            Assert.AreEqual(0, testPark.NumberOfCampsites);
            Assert.AreEqual("Woodland", testPark.Climate);
            Assert.AreEqual(2189849, testPark.AnnualVisitors);
            Assert.AreEqual("Of all the paths you take in life, make sure a few of them are dirt.", testPark.InspirationalQuote);
            Assert.AreEqual("John Muir", testPark.InspirationalQuoteSource);
            Assert.AreEqual("Though a short distance from the urban areas of Cleveland and Akron, Cuyahoga" +
                            " Valley National Park seems worlds away. The park is a refuge for native plants and wildlife, and " +
                            "provides routes of discovery for visitors. The winding Cuyahoga River gives way to deep forests, rolling " +
                            "hills, and open farmlands. Walk or ride the Towpath " +
                            "Trail to follow the historic route of the Ohio & Erie Canal", testPark.ParkDescription);
            Assert.AreEqual(0M, testPark.EntryFee);
            Assert.AreEqual(390, testPark.NumAnimalSpecies);
        }
 public ParkController(IParkGeekDAO db, IUserSecurityDAO sec_db, IHttpContextAccessor httpContext) : base(sec_db, httpContext)
 {
     _db = db;
 }
Example #8
0
 public SurveyController(IUserSecurityDAO db, IHttpContextAccessor httpContext, IParkGeekDAO daodb) : base(db, httpContext)
 {
     _db = daodb;
 }
 public ParkController(IUserSecurityDAO db1, IParkGeekDAO db2, IHttpContextAccessor httpContext) : base(db1, httpContext)
 {
     _db1 = db1;
     _db2 = db2;
 }
 public void Initialize()
 {
     _dao  = new ParkGeekDAO(_connectionstring);
     _tran = new TransactionScope();
 }
 public SurveyController(IParkGeekDAO parkDB, IUserSecurityDAO db, IHttpContextAccessor httpContext) : base(db, httpContext)
 {
     _db = parkDB;
 }
Example #12
0
 public ParkController(IParkGeekDAO dao, IUserSecurityDAO db, IHttpContextAccessor httpContext) : base(db, httpContext)
 {
     _dao = dao;
 }