public void ResolveSln_throws_exception_if_no_sln_found()
        {
            // arrange
            var rootDirectory = new DirectoryInfo(Directory.GetCurrentDirectory()).Root.FullName; // better not be a .sln file in the root
            var resolver      = new SlnFileResolver(rootDirectory, null);

            // act & assert
            var exception = Assert.Throws <InvalidOperationException>(() => resolver.ResolveSln());

            Assert.Contains("Could not find solution file", exception.Message);
        }
예제 #2
0
        protected override void ConfigureWebHost(IWebHostBuilder builder)
        {
            builder.UseEnvironment("Development");

            Environment.SetEnvironmentVariable(
                variable: "EJK_3d953564513b09af30c9c9724c52770a2ffd13862710de857f5ef75e69350e52",
                value: "edadd0dc3f1765d78122f752ca5c01292916cba2e7e09fe796f5dcc2423faadd");

            var contentRoot = new SlnFileResolver().ResolvePathRelativeToSln("examples/jaytwo.ejson.example.AspNetCore2_1");

            builder.UseContentRoot(contentRoot);
        }
        public void ResolvePathRelativeToSln_works(string basePath, string relativePath)
        {
            // arrange
            var resolver = new SlnFileResolver().WithBasePath(basePath);

            // act
            var fullPath = resolver.ResolvePathRelativeToSln(relativePath);

            // assert
            Assert.NotNull(fullPath);
            Assert.NotEmpty(fullPath);
            Assert.True(File.Exists(fullPath), $"File does not exist: {fullPath}");
        }
예제 #4
0
        public TestServerFixture()
        {
            Environment.SetEnvironmentVariable(
                variable: "EJK_3d953564513b09af30c9c9724c52770a2ffd13862710de857f5ef75e69350e52",
                value: "edadd0dc3f1765d78122f752ca5c01292916cba2e7e09fe796f5dcc2423faadd");

            var contentRoot = new SlnFileResolver().ResolvePathRelativeToSln("examples/jaytwo.ejson.example.AspNetCore1_1");

            _server = new TestServer(new WebHostBuilder()
                                     .UseEnvironment("Development")
                                     .UseContentRoot(contentRoot)
                                     .UseStartup <Startup>());
        }
        public void ResolvePathRelativeToSln_works_defaults()
        {
            // arrange
            var relativePath = "README.md";
            var resolver     = new SlnFileResolver();

            // act
            var fullPath = resolver.ResolvePathRelativeToSln(relativePath);

            // assert
            Assert.NotNull(fullPath);
            Assert.NotEmpty(fullPath);
            Assert.True(File.Exists(fullPath), $"File does not exist: {fullPath}");
        }
        public void ResolvePathRelativeToSln_works_with_different_sln_pattern()
        {
            // arrange
            var slnPattern   = "one.sln";
            var basePath     = "TestData/one/a/b";
            var relativePath = "a/foo.txt";
            var resolver     = new SlnFileResolver().WithBasePath(basePath).WithSlnPattern(slnPattern);

            // act
            var fullPath = resolver.ResolvePathRelativeToSln(relativePath);

            // assert
            Assert.NotNull(fullPath);
            Assert.NotEmpty(fullPath);
            Assert.True(File.Exists(fullPath), $"File does not exist: {fullPath}");
        }
 public static SlnFileResolver WithBasePath(this SlnFileResolver resolver, string basePath)
 {
     resolver.BasePath = basePath;
     return(resolver);
 }
 public static SlnFileResolver WithSlnPattern(this SlnFileResolver resolver, string slnPattern)
 {
     resolver.SlnPattern = slnPattern;
     return(resolver);
 }