Esempio n. 1
0
        public async void timer_insert_and_delete()
        {
            var timerTypeAccess = new TimerTypeAccess(_context);

            var item = new Timer
            {
                TimerTypeId = 2,
                UserName    = _fixture.Create <string>(),
                Date        = _fixture.Create <DateTime>(),
                Time        = _fixture.Create <TimeSpan>()
            };

            await _sut.SaveAsync(item);

            item.ID.Should().NotBe(0);

            var loaded = await _sut.LoadAsync(item.ID);

            var typeLoaded = await timerTypeAccess.LoadAsync(item.TimerTypeId);

            loaded.UserName.Should().Be(item.UserName);
            loaded.TimerType.Type.Should().Be(typeLoaded.Type);
            loaded.Date.Should().Be(item.Date);
            loaded.Time.Should().Be(item.Time);

            var deletedCount = await _sut.DeleteAsync(loaded);

            deletedCount.Should().BeGreaterOrEqualTo(1);
        }
Esempio n. 2
0
        public async void timerTypes_get_at_least_one()
        {
            var context         = new JobTimerDbContext();
            var timerTypeAccess = new TimerTypeAccess(context);
            var hrs             = await timerTypeAccess.GetAllAsync();

            hrs.Count.Should().BeGreaterThan(0);
        }
Esempio n. 3
0
        public async void timerType_insert_and_delete()
        {
            var context         = new JobTimerDbContext();
            var timerTypeAccess = new TimerTypeAccess(context);

            var timerType = new TimerType {
                ID = 99999, Type = _fixture.Create <string>()
            };

            await timerTypeAccess.SaveAsync(timerType);

            timerType.ID.Should().NotBe(0);

            var timerTypeLoaded = await timerTypeAccess.LoadAsync(timerType.ID);

            timerTypeLoaded.Type.Should().Be(timerType.Type);

            var deletedCount = await timerTypeAccess.DeleteAsync(timerTypeLoaded);

            deletedCount.Should().BeGreaterOrEqualTo(1);
        }