コード例 #1
0
        public static async Task ClassInitializeAsync(TestContext context)
        {
            StationType t1 = new StationType
            {
                StationTypeId = 2,
                Name          = "MyStationType1"
            };

            StationType t2 = new StationType
            {
                StationTypeId = 3,
                Name          = "MyStationType2"
            };

            StationType t3 = new StationType
            {
                StationTypeId = 4,
                Name          = "MyStationType3"
            };

            stationTypes.Add(t1);
            stationTypes.Add(t2);
            stationTypes.Add(t3);

            foreach (StationType s in stationTypes)
            {
                await stationTypeDao.InsertAsync(s);
            }
        }
コード例 #2
0
        public static async Task ClassInitializeAsync(TestContext context)
        {
            User user = new User
            {
                UserId    = 1,
                FirstName = "Andreas",
                LastName  = "Roither",
                Email     = "*****@*****.**",
                Password  = "******"
            };
            await userDao.InsertAsync(user);

            Country country = new Country
            {
                CountryId = 9,
                Name      = "TestCountry"
            };
            await countryDao.InsertAsync(country);

            Province province = new Province
            {
                CountryId  = 9,
                ProvinceId = 6,
                Name       = "TestProvince"
            };
            await provinceDao.InsertAsync(province);

            District district = new District
            {
                DistrictId = 6,
                ProvinceId = 6,
                Name       = "TestDistrict"
            };
            await districtDao.InsertAsync(district);

            Community community = new Community
            {
                DistrictId  = 6,
                CommunityId = 6,
                Name        = "TestCommunity"
            };
            await communityDao.InsertAsync(community);

            Address address = new Address
            {
                AddressId   = 6,
                CommunityId = 6,
                Location    = "TestLocation",
                Zip         = "124"
            };
            await addressDao.InsertAsync(address);

            StationType type = new StationType
            {
                StationTypeId = 1,
                Name          = "TestType"
            };
            await stationTypeDao.InsertAsync(type);

            Station station = new Station
            {
                StationId     = 1,
                Name          = "Station 1",
                Longitude     = 12,
                Latitude      = 12,
                StationTypeId = 1,
                AddressId     = 6,
                UserId        = 1
            };
            await stationDao.InsertAsync(station);
        }
コード例 #3
0
        public static async Task ClassInitializeAsync(TestContext context)
        {
            User user = new User()
            {
                UserId    = 23,
                FirstName = "Daniel",
                LastName  = "Englisch",
                Email     = "*****@*****.**",
                Password  = "******"
            };

            await userDao.InsertAsync(user);

            Country country = new Country
            {
                CountryId = 33,
                Name      = "MyCountry"
            };

            await countryDao.InsertAsync(country);

            Province province = new Province
            {
                ProvinceId = 66,
                CountryId  = country.CountryId,
                Name       = "MyProvince"
            };

            await provinceDao.InsertAsync(province);

            District district = new District
            {
                DistrictId = 54,
                ProvinceId = province.ProvinceId,
                Name       = "MyDistrict"
            };

            await districtDao.InsertAsync(district);

            Community community = new Community
            {
                CommunityId = 74,
                DistrictId  = district.DistrictId,
                Name        = "MyCommunity"
            };

            await communityDao.InsertAsync(community);

            Address address = new Address
            {
                AddressId   = 93,
                CommunityId = community.CommunityId,
                Location    = "Waidhofnerstraße 34a",
                Zip         = "332A"
            };

            await addressDao.InsertAsync(address);

            StationType stationType = new StationType
            {
                StationTypeId = 83,
                Name          = "DeluxeStation"
            };

            await stationTypeDao.InsertAsync(stationType);

            Station station = new Station
            {
                StationId     = 32,
                UserId        = user.UserId,
                AddressId     = address.AddressId,
                Name          = "TemperaturStation",
                Latitude      = 3.323M,
                Longitude     = -3.333M,
                StationTypeId = stationType.StationTypeId
            };

            await stationDao.InsertAsync(station);

            MeasurementType measurementType = new MeasurementType
            {
                MeasurementTypeId = 43,
                Name = "Temperatur"
            };

            await measurementTypeDao.InsertAsync(measurementType);

            Unit unit = new Unit
            {
                UnitId = 34,
                Name   = "Celcius"
            };

            await unitDao.InsertAsync(unit);

            Measurement m1 = new Measurement
            {
                MeasurementId     = 44,
                MeasurementTypeId = measurementType.MeasurementTypeId,
                StationId         = station.StationId,
                Value             = 23.3,
                TimesStamp        = DateTime.FromFileTime(131862006360000000),
                UnitId            = unit.UnitId
            };

            Measurement m2 = new Measurement
            {
                MeasurementId     = 45,
                MeasurementTypeId = measurementType.MeasurementTypeId,
                StationId         = station.StationId,
                Value             = -0.3,
                TimesStamp        = DateTime.Now,
                UnitId            = unit.UnitId
            };

            Measurement m3 = new Measurement
            {
                MeasurementId     = 46,
                MeasurementTypeId = measurementType.MeasurementTypeId,
                StationId         = station.StationId,
                Value             = 12.85,
                TimesStamp        = DateTime.Now,
                UnitId            = unit.UnitId
            };

            measurements.Add(m1);
            measurements.Add(m2);
            measurements.Add(m3);

            foreach (var m in measurements)
            {
                await measurementDao.InsertAsync(m);
            }
        }