forked from Azure/azure-functions-host
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extension metadata generation improvements
- Loading branch information
Showing
8 changed files
with
124 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
...onsMetadataGenerator/src/ExtensionsMetadataGenerator.Console/Extensions/TypeExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...tadataGenerator/test/ExtensionsMetadataGeneratorTests/ExtensionsMetadataGeneratorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Linq; | ||
using Newtonsoft.Json.Linq; | ||
using Xunit; | ||
|
||
namespace ExtensionsMetadataGeneratorTests | ||
{ | ||
public class ExtensionsMetadataGeneratorTests | ||
{ | ||
[Fact] | ||
public void GenerateExtensionReferences_Succeeds() | ||
{ | ||
var assembly = GetType().Assembly; | ||
var references = ExtensionsMetadataGenerator.ExtensionsMetadataGenerator.GenerateExtensionReferences(assembly).ToArray(); | ||
Assert.Equal(2, references.Length); | ||
|
||
Assert.Equal("Foo", references[0].Name); | ||
Assert.Equal(assembly.FullName, references[0].TypeName); | ||
|
||
Assert.Equal("BarExtension", references[1].Name); | ||
Assert.Equal(assembly.FullName, references[1].TypeName); | ||
} | ||
|
||
[Fact] | ||
public void GenerateExtensionsJson_Succeeds() | ||
{ | ||
var assembly = GetType().Assembly; | ||
var references = ExtensionsMetadataGenerator.ExtensionsMetadataGenerator.GenerateExtensionReferences(assembly).ToArray(); | ||
string json = ExtensionsMetadataGenerator.ExtensionsMetadataGenerator.GenerateExtensionsJson(references); | ||
|
||
var root = JObject.Parse(json); | ||
var extensions = root["extensions"]; | ||
|
||
Assert.Equal("Foo", extensions[0]["name"]); | ||
Assert.Equal(assembly.FullName, extensions[0]["typeName"]); | ||
|
||
Assert.Equal("BarExtension", extensions[1]["name"]); | ||
Assert.Equal(assembly.FullName, extensions[1]["typeName"]); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...taGenerator/test/ExtensionsMetadataGeneratorTests/ExtensionsMetadataGeneratorTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0-beta7-11404" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> | ||
<PackageReference Include="xunit" Version="2.4.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\ExtensionsMetadataGenerator.Console\ExtensionsMetadataGenerator.Console.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
23 changes: 23 additions & 0 deletions
23
...s/ExtensionsMetadataGenerator/test/ExtensionsMetadataGeneratorTests/TestWebJobsStartup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using ExtensionsMetadataGeneratorTests; | ||
using Microsoft.Azure.WebJobs; | ||
using Microsoft.Azure.WebJobs.Hosting; | ||
|
||
[assembly: WebJobsStartup(typeof(FooWebJobsStartup))] | ||
[assembly: WebJobsStartup(typeof(BarWebJobsStartup), "BarExtension")] | ||
|
||
namespace ExtensionsMetadataGeneratorTests | ||
{ | ||
public class FooWebJobsStartup : IWebJobsStartup | ||
{ | ||
public void Configure(IWebJobsBuilder builder) | ||
{ | ||
} | ||
} | ||
|
||
public class BarWebJobsStartup : IWebJobsStartup | ||
{ | ||
public void Configure(IWebJobsBuilder builder) | ||
{ | ||
} | ||
} | ||
} |