Ejemplo n.º 1
0
        public void DeleteEventAsyncShouldDeleteEventCorrectly()
        {
            var options = new DbContextOptionsBuilder <IntillegioContext>()
                          .UseInMemoryDatabase(databaseName: "Delete_Event_Db")
                          .Options;

            var dbContext = new IntillegioContext(options);

            var service = new EventsService(dbContext, null);

            var eventure = new Event();

            dbContext.Events.Add(eventure);
            dbContext.SaveChanges();

            var eventureId = dbContext.Events.LastOrDefault().Id;

            service.DeleteEventAsync(eventureId);

            Assert.True(dbContext
                        .Events
                        .Any(a => a.Id == eventureId) == false);
        }