public void ReturnsIntermediateFileFromVariable() { var contents = "SampleGoogleServices"; var environmentName = nameof(ReturnsIntermediateFileFromVariable); Environment.SetEnvironmentVariable(environmentName, contents, EnvironmentVariableTarget.Process); var path = GoogleTask.GetResourcePath(environmentName, IntermediateOutputDirectory, "google-services.json"); var expectedPath = Path.Combine(IntermediateOutputDirectory, "google-services", "google-services.json"); Assert.Equal(expectedPath, path); Assert.Equal(contents, File.ReadAllText(path)); }
public void ReturnsSpecifiedFileFromAbsolutePath() { var contents = "SampleGoogleServices"; var directory = Path.Combine("Generated", "tests", nameof(ReturnsSpecifiedFileFromAbsolutePath)); Directory.CreateDirectory(directory); var expectedPath = new FileInfo(Path.Combine(directory, "google-test.json")).FullName; File.WriteAllText(expectedPath, contents); var environmentName = nameof(ReturnsSpecifiedFileFromAbsolutePath); Environment.SetEnvironmentVariable(environmentName, expectedPath, EnvironmentVariableTarget.Process); var path = GoogleTask.GetResourcePath(environmentName, IntermediateOutputDirectory, "google-services.json"); Assert.Equal(expectedPath, path); }