Esempio n. 1
0
        public void CheckIfCompanyNameIsAvailableShouldReturnTrueIfCompanyExist()
        {
            var options = new DbContextOptionsBuilder <TaskPlannerDbContext>()
                          .UseInMemoryDatabase(databaseName: "Company_CheckCompanyName_Database")
                          .Options;

            var dbContext = new TaskPlannerDbContext(options);

            var company = new Company
            {
                Name           = "DataCenter",
                Address        = "asd",
                FieldOfService = "IT"
            };

            dbContext.Companies.Add(company);

            var companyService = new CompanyService(dbContext, null);

            var result = companyService.CheckIfCompanyNameIsAvailable(company.Name);

            Assert.True(result);
        }