예제 #1
0
        public void Exist_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.Exists(1);

                Assert.False(result);
            }
        }
예제 #2
0
        public void Exist_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"
                };

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

                var qualificationsService = new QualificationsService(dbContext);
                var result = qualificationsService.Exists(1);

                Assert.True(result);
            }
        }