protected CakeAliasGeneratorFixture() { // Get all aliases in the current assembly. _assembly = typeof(CakeAliasGeneratorFixture <T>).GetTypeInfo().Assembly; // Load all Cake aliases. // TODO: Not ideal with IO-access here, but we need to load the assembly. // See if we can load the information by providing the assembly directly. var finder = new CakeScriptAliasFinder(new FileSystem()); _aliases = finder.FindAliases(new FilePath(_assembly.Location)); // Create the generator. // ReSharper disable once VirtualMemberCallInConstructor _generator = CreateGenerator(); }
public void Should_Include_Namespaces_For_Alias() { // Given var fileSystem = new FileSystem(); var finder = new CakeScriptAliasFinder(fileSystem); // When var aliases = finder.FindAliases(new FilePath(typeof(CakeScriptAliasFinderTests).GetTypeInfo().Assembly.Location)); // Then var alias = aliases.Single(a => a.Name == "NonGeneric_ExtensionMethodWithNoParameters"); Assert.NotNull(alias); Assert.Equal(4, alias.Namespaces.Count); Assert.Contains("Cake.Scripting.Tests.Data", alias.Namespaces); Assert.Contains("Foo.Bar.Assembly", alias.Namespaces); Assert.Contains("Foo.Bar.Type", alias.Namespaces); Assert.Contains("Foo.Bar.Method", alias.Namespaces); }