예제 #1
0
        public void RemoveAsync_ReturnsFalse()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;

            using (var dbContext = new ApplicationDbContext(options))
            {
                var qualificationsService = new QualificationsService(dbContext);

                var result = qualificationsService.RemoveAsync(1);

                Assert.False(result.Result);
            }
        }
예제 #2
0
        public void RemoveAsync_ReturnsTrue()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options;

            using (var dbContext = new ApplicationDbContext(options))
            {
                Qualification qualification = new Qualification()
                {
                    Name = "TestQualification", Description = "random desc"
                };
                var qualificationsService = new QualificationsService(dbContext);

                dbContext.Qualifications.Add(qualification);
                dbContext.SaveChanges();

                var result = qualificationsService.RemoveAsync(1);

                Assert.True(result.Result);
            }
        }