コード例 #1
0
        public void TestCheckLocationExistsFalse()
        {
            // Arrange
            var optionsBuilder = new DbContextOptionsBuilder <Project1Context>();

            optionsBuilder.UseSqlServer(SecretConfiguration.ConnectionString);
            var options = optionsBuilder.Options;

            using (var dbContext = new Project1Context(options))
            {
                ILocationRepo p0Repo = new LocationRepo(dbContext);

                // Act and Assert
                Assert.False(p0Repo.CheckLocationExists(100000));
            }
        }
コード例 #2
0
        public void TestCheckLocationExistsTrue()
        {
            // Arrange
            var optionsBuilder = new DbContextOptionsBuilder <Project1Context>();

            optionsBuilder.UseSqlServer(SecretConfiguration.ConnectionString);
            var options = optionsBuilder.Options;

            using (var dbContext = new Project1Context(options))
            {
                ILocationRepo p0Repo    = new LocationRepo(dbContext);
                var           locations = p0Repo.GetAllLocations();
                // Act and Assert
                Assert.True(p0Repo.CheckLocationExists(locations.ToList().First().Id));
            }
        }