Beispiel #1
0
        public async void GetAll_ShouldGetAll()
        {
            var service = new CrudServiceImpl(_context);
            var tapes   = await service.GetAll();

            Assert.Equal(10, tapes.Count());
        }
Beispiel #2
0
        public async void Create_ShouldCreate()
        {
            var service = new CrudServiceImpl(_context);

            service.Create(BogusDataGenerators.GetTape());
            var tapes = await service.GetAll();

            Assert.Equal(11, tapes.Count());
        }
Beispiel #3
0
        public async void Remove_ShouldRemove()
        {
            var service = new CrudServiceImpl(_context);
            var tapes   = await service.GetAll();

            Assert.Equal(10, tapes.Count());
            service.Delete(await service.GetSingle(1));
            tapes = await service.GetAll();

            Assert.Equal(9, tapes.Count());
        }
Beispiel #4
0
        public async void Update_ShouldUpdate()
        {
            var service = new CrudServiceImpl(_context);

            service.Create(BogusDataGenerators.GetTape());

            var tape = await service.GetSingle(1);

            tape.Title = "Updated title";
            service.Update(tape);
            tape = await service.GetSingle(1);

            Assert.Equal("Updated title", tape.Title);
        }
Beispiel #5
0
 public async void GetSingle_ShouldThrowNotFound()
 {
     var service = new CrudServiceImpl(_context);
     await Assert.ThrowsAsync <NotFoundException>(() => service.GetSingle(int.MaxValue));
 }