Esempio n. 1
0
 public TrafficDetector Add(TrafficDetector trafficDetector)
 {
     return(_context
            .TrafficDetectors
            .Add(trafficDetector)
            .Entity);
 }
Esempio n. 2
0
        public async Task should_add_new_item()
        {
            var testTrafficDetector = new TrafficDetector
            {
                Name      = "Zakrzowek",
                Latitude  = 50.080852F,
                Longitude = 19.950825F
            };

            _repo.Add(testTrafficDetector);
            await _repo.UnitOfWork.SaveEntitiesAsync();

            await _context.TrafficDetectors.FirstOrDefaultAsync(_ => _.Id == testTrafficDetector.Id).ShouldNotBeNull();
        }
Esempio n. 3
0
        public async Task should_update_traffic_detector()
        {
            var testTrafficDetector = new TrafficDetector
            {
                Id        = new Guid("f8de7cdc-c94c-4f94-9577-9613087e00b5"),
                Name      = "Zakrzowek",
                Latitude  = 50.080852F,
                Longitude = 19.950825F
            };

            _repo.Update(testTrafficDetector);

            await _repo.UnitOfWork.SaveEntitiesAsync();

            _context.TrafficDetectors.FirstOrDefaultAsync(x => x.Id == testTrafficDetector.Id)?.Result.Name.ShouldBe("Zakrzowek");
        }
Esempio n. 4
0
 public TrafficDetector Update(TrafficDetector trafficDetector)
 {
     _context.Entry(trafficDetector).State = EntityState.Modified;
     return(trafficDetector);
 }