Ejemplo n.º 1
0
        public void Get_EvenementById()
        {
            EvenementController controller = new EvenementController(_context);
            var evenement = controller.GetById(1);

            Assert.IsInstanceOfType(evenement, typeof(CreatedResult));
            CreatedResult cEvenement = (CreatedResult)evenement;

            Evenement e = (Evenement)cEvenement.Value;

            e.Should().NotBeNull();
            e.id.Should().Be(1);
        }
Ejemplo n.º 2
0
        public void Delete_ExistingEvenement()
        {
            DataAccessProvider dp = new DataAccessProvider(_context);

            Evenement existingEvent = dp.GetEventById(1);

            var deletedEvent = new EvenementController(_context).Delete(existingEvent.id);

            Assert.IsInstanceOfType(deletedEvent, typeof(OkResult));

            int nbEvent = dp.GetAllEvent().Count;

            nbEvent.Should().Be(1);

            Evenement nullEvent = dp.GetEventById(existingEvent.id);

            nullEvent.Should().BeNull();
        }