Esempio n. 1
0
        public async void CoordinatesCreationAsync()
        {
            var coordsRep = new CoordinatesRepository();
            var usersRep  = new UsersRepository();

            var user = await usersRep.CreateAsync(101);

            var coords = new Coordinates {
                UserId = user.Id, Date = DateTime.Now
            };
            var putCount = await coordsRep.PutAsync(coords);

            try
            {
                Assert.That(putCount, Is.EqualTo(1));
                Assert.That(coords.Id, Is.GreaterThan(0));

                var getted = await coordsRep.GetAsync(user.Name);

                Assert.That(getted.Length, Is.EqualTo(1));
                Assert.That(getted[0].Id, Is.EqualTo(coords.Id));
            }
            finally
            {
                var count = coordsRep.Remove(coords);
                Assert.That(count, Is.EqualTo(1));

                usersRep.Remove(user);
            }
        }
Esempio n. 2
0
        public CoordinatesController()
        {
            var container = LightInjectCore.Get();

            _rep = container.GetInstance <CoordinatesRepository>();
            Logger.Trace("Создан контроллер.");
        }
Esempio n. 3
0
        public void SaveWifiHotspots(IEnumerable <WifiHotspot> wifiHotspots)
        {
            WifiHotspotRepository.Save(wifiHotspots);
            foreach (var wifiHotspot in wifiHotspots)
            {
                wifiHotspot.Address.WifiHotspotId     = wifiHotspot.Id;
                wifiHotspot.Coordinates.WifiHotspotId = wifiHotspot.Id;
            }

            CoordinatesRepository.Save(wifiHotspots.Select(x => x.Coordinates));
            AddressRepository.Save(wifiHotspots.Select(x => x.Address));
        }
Esempio n. 4
0
 public void DeleteAllWifiHotspots()
 {
     CoordinatesRepository.DeleteAll();
     AddressRepository.DeleteAll();
     WifiHotspotRepository.DeleteAll();
 }