-
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.
- Loading branch information
Showing
14 changed files
with
148 additions
and
30 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
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
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,30 @@ | ||
namespace Sundew.Injection.Tests.Playground; | ||
|
||
extern alias sbt; | ||
using FluentAssertions.Execution; | ||
using sbt::Sundew.Base.Text; | ||
using Sundew.Injection.Generator.Stages.InjectionDefinitionStage; | ||
using Sundew.Injection.Testing; | ||
|
||
[TestFixture] | ||
public class NestedTests | ||
{ | ||
[Test] | ||
public void T() | ||
{ | ||
var compilation = TestProjects.TestPlayground.FromCurrentDirectory.Value; | ||
var demoModuleDeclaration = compilation.GetTypeByMetadataName("TestPlayground.FactoryDeclaration"); | ||
if (demoModuleDeclaration == null) | ||
{ | ||
Assert.Fail($"Could not find FactoryDeclaration. Compilation had: {compilation.GetDiagnostics().Length} diagnostics"); | ||
throw new NotImplementedException("Assert.Fail is marked as throws."); | ||
} | ||
|
||
var injectionDefinitionSemanticModel = compilation.GetSemanticModel(demoModuleDeclaration.DeclaringSyntaxReferences.First().SyntaxTree, true); | ||
var injectionDefinition = InjectionDefinitionProvider.GetInjectionDefinition(injectionDefinitionSemanticModel, CancellationToken.None); | ||
if (!injectionDefinition.IsSuccess) | ||
{ | ||
throw new AssertionFailedException($"InjectionDefinition should have been successful, but failed with errors: {injectionDefinition.Error.JoinToString((builder, item) => builder.Append(item), ", ")}"); | ||
} | ||
} | ||
} |
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
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
16 changes: 16 additions & 0 deletions
16
Source/TestProjects/AllFeaturesSuccess/NestingTypes/NestedConsumer.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,16 @@ | ||
namespace AllFeaturesSuccess.NestingTypes; | ||
|
||
using System; | ||
|
||
public class NestedConsumer : IPrint | ||
{ | ||
public NestedConsumer(Nestee.Nested nested) | ||
{ | ||
|
||
} | ||
|
||
public void PrintMe(int indent) | ||
{ | ||
Console.WriteLine(new string(' ', indent) + this.GetType().Name); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
Source/TestProjects/AllFeaturesSuccess/NestingTypes/Nestee.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,8 @@ | ||
namespace AllFeaturesSuccess.NestingTypes; | ||
|
||
public class Nestee | ||
{ | ||
public class Nested | ||
{ | ||
} | ||
} |
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
22 changes: 10 additions & 12 deletions
22
Source/TestProjects/NetStandardLibrarySuccess/FactoryDeclaration.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 |
---|---|---|
@@ -1,18 +1,16 @@ | ||
| ||
namespace NetStandardLibrarySuccess | ||
{ | ||
using System.Threading.Tasks; | ||
using Sundew.Injection; | ||
namespace NetStandardLibrarySuccess; | ||
|
||
public class FactoryDeclaration : IInjectionDeclaration | ||
{ | ||
public void Configure(IInjectionBuilder injectionBuilder) | ||
{ | ||
injectionBuilder.CreateFactory<T>(); | ||
} | ||
} | ||
using Sundew.Injection; | ||
|
||
public class T | ||
public class FactoryDeclaration : IInjectionDeclaration | ||
{ | ||
public void Configure(IInjectionBuilder injectionBuilder) | ||
{ | ||
injectionBuilder.CreateFactory<T>(); | ||
} | ||
} | ||
|
||
public class T | ||
{ | ||
} |
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,11 @@ | ||
| ||
namespace TestPlayground; | ||
|
||
using Sundew.Injection; | ||
|
||
public class FactoryDeclaration : IInjectionDeclaration | ||
{ | ||
public void Configure(IInjectionBuilder injectionBuilder) | ||
{ | ||
} | ||
} |
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,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<LangVersion>11</LangVersion> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" /> | ||
<PackageReference Include="System.Collections.Immutable" GeneratePathProperty="true" PrivateAssets="all" /> | ||
<PackageReference Include="Disposal.Interfaces" GeneratePathProperty="true" PrivateAssets="all" /> | ||
<PackageReference Include="Initialization.Interfaces" GeneratePathProperty="true" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Sundew.Injection\Sundew.Injection.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="true" /> | ||
<ProjectReference Include="..\AllFeaturesSuccessDependency\AllFeaturesSuccessDependency.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |