Skip to content

Commit

Permalink
Fixed the build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Maarten Kools committed Dec 19, 2018
1 parent b90691a commit ecbf3c6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 41 deletions.
74 changes: 36 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,49 @@ A SpecFlow plugin that provides a generic way to implement a custom DI container
```csharp
public class SimpleInjectorContainer : IGenericContainer
{
private readonly Container _container;
private readonly Container _container;

public SimpleInjectorContainer(Container container)
{
_container = container;
}

public void Register<TService>(Func<TService> instanceCreator)
where TService : class
{
_container.Register(instanceCreator);
}

public object Resolve(Type bindingType)
{
return _container.GetInstance(bindingType);
}

public TService Resolve<TService>()
where TService : class
{
return _container.GetInstance<TService>();
}
_container = container;
}

public void Register<TService>(Func<TService> instanceCreator)
where TService : class
{
_container.Register(instanceCreator);
}

public object Resolve(Type bindingType)
{
return _container.GetInstance(bindingType);
}

public TService Resolve<TService>()
where TService : class
{
return _container.GetInstance<TService>();
}
}
```
```csharp
public static class Dependencies
{
[ScenarioDependencies]
public static IGenericContainer CreateContainer()
{
var container = new Container();
container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
container.Options.DefaultLifestyle = Lifestyle.Singleton;

// Add your registrations here
foreach (var type in typeof(Dependencies).Assembly
.GetTypes()
.Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))))
{
container.Register(type);
}

return new SimpleInjectorContainer(container);
}
[ScenarioDependencies]
public static IGenericContainer CreateContainer()
{
var container = new Container();
container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
container.Options.DefaultLifestyle = Lifestyle.Singleton;

// Add your registrations here
foreach (var type in typeof(Dependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))))
{
container.Register(type);
}

return new SimpleInjectorContainer(container);
}
}
```
3 changes: 0 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ before_build:
- cmd: dotnet build .\src\SpecFlow.GenericContainer.sln -c Release -v q --no-restore /nologo
- cmd: dotnet pack .\src\SpecFlow.GenericContainer.sln -c Release -o .\artifacts --include-symbols --no-build --no-restore /nologo -p:PackageVersion="%GitVersion_NuGetVersion%"

build_script:
- ps: .\build.ps1

artifacts:
- path: '.\artifacts\**\*.nupkg'
name: NuGet
Expand Down

0 comments on commit ecbf3c6

Please sign in to comment.