public void DependencyInjection_ServiceCollection_WritesCorrectly() { var collection = GetServiceCollection(); var result = DependencyInjectionTestHelpers.GetContainerContentsLog(collection); result.Should().NotBeNullOrWhiteSpace(); var baseline = File.ReadAllText(Path.Combine(projectPath, "Baselines/ServiceCollection.txt")); result.Should().Be(baseline); }
public async Task DI_CompareCurrentVersion_ToRC2() { var provider = await RestierTestHelpers.GetTestableInjectionContainer <LibraryApi, LibraryContext>(); var result = DependencyInjectionTestHelpers.GetContainerContentsLog(provider); result.Should().NotBeNullOrEmpty(); var baseline = File.ReadAllText("..//..//..//..//Microsoft.Restier.Tests.AspNet//Baselines/RC2-LibraryApi-ServiceProvider.txt"); result.Should().Be(baseline); }
public async Task WriteServiceCollectionOutputLog_Async(string projectPath) { var collection = GetServiceCollection(); var result = DependencyInjectionTestHelpers.GetContainerContentsLog(collection); var fullPath = Path.Combine(projectPath, "Baselines//ServiceCollection.txt"); if (!Directory.Exists(Path.GetDirectoryName(fullPath))) { Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); } File.WriteAllText(fullPath, result); await Task.FromResult(0); }
public async Task ContainerContents_WriteOutput(string projectPath) { var provider = await RestierTestHelpers.GetTestableInjectionContainer <LibraryApi, LibraryContext>(); var result = DependencyInjectionTestHelpers.GetContainerContentsLog(provider); var fullPath = Path.Combine(projectPath, "..//Microsoft.Restier.Tests.AspNet//Baselines//RC2-LibraryApi-ServiceProvider.txt"); Console.WriteLine(fullPath); if (!Directory.Exists(Path.GetDirectoryName(fullPath))) { Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); } File.WriteAllText(fullPath, result); Console.WriteLine($"File exists: {File.Exists(fullPath)}"); }
public void WriteHostBuilderOutputLog(string projectPath) { var host = GetSimpleMessageBusHost(); var result = DependencyInjectionTestHelpers.GetContainerContentsLog(host); #if NET6_0_OR_GREATER var fullPath = Path.Combine(projectPath, "Baselines//HostBuilder_NET6.txt"); #endif #if NET5_0 var fullPath = Path.Combine(projectPath, "Baselines//HostBuilder_NET5.txt"); #endif #if NETCOREAPP3_1 var fullPath = Path.Combine(projectPath, "Baselines//HostBuilder_NETCOREAPP31.txt"); #endif if (!Directory.Exists(Path.GetDirectoryName(fullPath))) { Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); } File.WriteAllText(fullPath, result); }
public void DependencyInjection_HostBuilder_WritesCorrectly() { var host = GetSimpleMessageBusHost(); var result = DependencyInjectionTestHelpers.GetContainerContentsLog(host); result.Should().NotBeNullOrWhiteSpace(); //RWM: If we're in a .NET Core test, remove the Core crap. //result = result.Replace("Core", ""); #if NET6_0 var baseline = File.ReadAllText(Path.Combine(projectPath, "Baselines/HostBuilder_NET6.txt")); #endif #if NET5_0 var baseline = File.ReadAllText(Path.Combine(projectPath, "Baselines/HostBuilder_NET5.txt")); #endif #if NETCOREAPP3_1 var baseline = File.ReadAllText(Path.Combine(projectPath, "Baselines/HostBuilder_NETCOREAPP31.txt")); #endif result.Should().Be(baseline); }