Compare commits

...

7 Commits

Author SHA1 Message Date
b02a68a62a .gitea/workflows/artifacts.yaml aktualisiert
All checks were successful
dotnet package / build (7.0.x) (push) Successful in 53s
/ upload-many (push) Successful in 8s
/ download-many (push) Successful in 8s
/ upload-one (push) Successful in 2s
/ download-one (push) Successful in 3s
2024-03-12 17:25:47 +01:00
e4ba50f337 .gitea/workflows/artifacts.yaml hinzugefügt
Some checks failed
dotnet package / build (7.0.x) (push) Has been cancelled
/ upload-many (push) Has been cancelled
/ download-many (push) Has been cancelled
/ upload-one (push) Has been cancelled
/ download-one (push) Has been cancelled
2024-03-12 17:18:32 +01:00
45cc9dfce9 .gitea/workflows/unittest.yaml aktualisiert
All checks were successful
dotnet package / build (7.0.x) (push) Successful in 1m39s
2024-03-12 17:09:42 +01:00
4dce511b57 .gitea/workflows/test.yaml aktualisiert
All checks were successful
dotnet package / build (7.0.x) (push) Successful in 56s
2023-11-15 22:34:31 +01:00
90b7c99e08 .gitea/workflows/test.yaml aktualisiert
Some checks failed
dotnet package / build (8.0.x) (push) Failing after 1m43s
2023-11-15 22:31:55 +01:00
22c6f5a109 Implementing unit tests. Mainly for testing the Actions of gitea (#1)
All checks were successful
dotnet package / build (7.0.x) (push) Successful in 58s
Reviewed-on: #1
2023-06-29 11:15:23 +02:00
02dbea83e7 implement first real unit test
All checks were successful
build (7.0.x)
dotnet package / build (7.0.x) (push) Successful in 55s
2023-03-29 22:11:29 +02:00
5 changed files with 65 additions and 19 deletions

View File

@ -0,0 +1,47 @@
on: [push]
jobs:
upload-many:
runs-on: ubuntu-latest
steps:
- run: mkdir -p artifacts
- run: touch artifacts/ONE artifacts/TWO
- uses: actions/upload-artifact@v3
with:
name: many-artifacts
path: artifacts/
download-many:
needs: [upload-many]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- run: |
test -f many-artifacts/ONE
test -f many-artifacts/TWO
upload-one:
runs-on: ubuntu-latest
steps:
- run: mkdir -p path/to/artifact
- run: echo hello > path/to/artifact/world.txt
- uses: actions/upload-artifact@v3
with:
name: my-artifact
path: path/to/artifact/world.txt
download-one:
needs: [upload-one]
runs-on: ubuntu-latest
steps:
- run: "! test -f world.txt"
- uses: actions/download-artifact@v3
with:
name: my-artifact
- run: "test -f world.txt"

View File

@ -18,7 +18,5 @@ jobs:
dotnet-version: ${{ matrix.dotnet-version }} dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies - name: Install dependencies
run: dotnet restore run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test - name: Test
run: dotnet test --no-restore --verbosity normal run: dotnet test --no-restore --verbosity normal

View File

@ -16,4 +16,8 @@
<PackageReference Include="coverlet.collector" Version="3.1.2" /> <PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SmallInjector\SmallInjector.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -1,20 +1,17 @@
namespace SmallInjector.Tests namespace SmallInjector.Tests;
public class Tests
{ {
public class Tests [SetUp]
public void Setup() { }
[Test]
public void TestInstatiationAndRegistering()
{ {
[SetUp] IContainer container = new Container();
public void Setup() { } container.RegisterType(true, container);
Assert.That(container.IsRegistered(typeof(IContainer)), Is.True);
[Test] var resolved = container.Resolve<IContainer>();
public void Test1() Assert.That(resolved, Is.EqualTo(container));
{
Assert.Pass();
}
[Test]
public void Test2()
{
Assert.Fail();
}
} }
} }

View File

@ -12,7 +12,7 @@ public class Container : IContainer
{ {
if (!IsRegistered<TInterface>()) if (!IsRegistered<TInterface>())
{ {
_container[typeof(TInterface)] = new List<RegisteredType> { new RegisteredType(typeof(TService), isSingleton, null) }; _container[typeof(TInterface)] = new List<RegisteredType> { new RegisteredType(typeof(TService), isSingleton, instance) };
} }
else else
{ {