예제 #1
0
 public void Create_validWeather_NotNull()
 {
     Domain.DomainEntities.Weather testWeather = new Domain.DomainEntities.Weather();
     testWeather.type          = "testType";
     testWeather.description   = "testDescription";
     testWeather.default_genre = "testGenre";
     wdb.CreateWeather(testWeather);
     Assert.IsTrue(wdb.GetWeather(testWeather).description == "testDescription");
 }
예제 #2
0
        public ICommandResult Handle(NewWeatherCommand command)
        {
            if (!command.IsValid())
            {
                return(new CommandResult(false, "Weather Invalid"));
            }

            //Generar las entidades
            var weather = new Weather(command.Type, command.Description, command.Date, command.PlanetPosition);

            //Guardar en la base
            _repository.CreateWeather(weather);

            return(new CommandResult(true, "New Weather Day created"));
        }
예제 #3
0
        private void AddWorkout()
        {
            transaction = new TransactionScope();


            dailyMetricsRepo = new SqlDailyMetricsRepository(connectionString);
            locationRepo     = new SqlLocationRepository(connectionString);
            weatherRepo      = new SqlWeatherRepository(connectionString);
            environmentRepo  = new SqlEnvironmentRepository(connectionString);
            sessionRepo      = new SqlSessionRepository(connectionString);
            workoutRepo      = new SqlWorkoutRepository(connectionString);

            transaction.Dispose();

            var dailyMetric = dailyMetricsRepo.CreateDailyMetrics(Date, Weight, SleepDuration, Calories);
            var location    = locationRepo.CreateLocation(Location);
            var weather     = weatherRepo.CreateWeather(WeatherType);
            var enviroment  = environmentRepo.CreateEnvironment(weather.WeatherID, location.LocationID, IsIndoor);
            var session     = sessionRepo.CreateSession(dailyMetric.MetricID, enviroment.EnvironmentID, StartTime, EndTime, Rating);
            var workout     = workoutRepo.CreateWorkout(session.SessionID, Duration, AvgHeartRate);
        }
예제 #4
0
        public void SetPreference_validPreference_True()
        {
            Domain.DomainEntities.User testUser = new Domain.DomainEntities.User();
            testUser.username = "******";
            testUser.password = "******";
            testUser.location = "98908";
            udb.Create(testUser);

            Domain.DomainEntities.Weather testWeather = new Domain.DomainEntities.Weather();
            testWeather.type          = "testType";
            testWeather.description   = "testDescription";
            testWeather.default_genre = "testGenre";
            wdb.CreateWeather(testWeather);

            Domain.DomainEntities.Preference testPreference = new Domain.DomainEntities.Preference();
            testPreference.genre      = "testGenre";
            testPreference.weather_id = wdb.GetWeather(testWeather).weather_id;
            testPreference.user_id    = udb.Find(testUser.username).id;
            pdb.SetPreference(testPreference);
            Assert.IsTrue(true);
        }