Esempio n. 1
0
        public void AddToDb()
        {
            var tracker = new StopwatchTracker(DateTime.Now);

            var ctx = new StopTrackerDbContext();

            ctx.stopwatchTrackers.Add(tracker);
            ctx.SaveChanges();

            Assert.IsNotNull(tracker.Id);
            ctx.Dispose();
        }
Esempio n. 2
0
        public void DeleteData()
        {
            var ctx = new StopTrackerDbContext();

            var trackers = ctx.stopwatchTrackers.ToList();

            ctx.stopwatchTrackers.RemoveRange(trackers);
            ctx.SaveChanges();

            var result = ctx.stopwatchTrackers.ToList();

            Assert.AreEqual(0, result.Count());
            ctx.Dispose();
        }
Esempio n. 3
0
        public void GetData()
        {
            var ctx = new StopTrackerDbContext();

            var newTracker = new StopwatchTracker(DateTime.Now);

            ctx.stopwatchTrackers.Add(newTracker);
            ctx.SaveChanges();

            var trackers = ctx.stopwatchTrackers.ToList();

            Assert.AreNotEqual(0, trackers.Count());
            ctx.Dispose();
        }