Skip to content

Commit

Permalink
Merge pull request #26 from z4kn4fein/dev
Browse files Browse the repository at this point in the history
Version increase on PR
  • Loading branch information
z4kn4fein authored Jun 9, 2017
2 parents b97129e + 6191997 commit e206ce2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
3 changes: 0 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ deploy:

skip_tags: true

pull_requests:
do_not_increment_build_number: true

image: Visual Studio 2017

configuration: Release
Expand Down
24 changes: 24 additions & 0 deletions src/stashbox.tests/DecoratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,30 @@ public void DecoratorTests_RemapDecorator_V2()
}
}

[TestMethod]
public void DecoratorTests_RemapDecorator_WithConfig()
{
using (var container = new StashboxContainer())
{
container.RegisterType<ITest1, Test1>();
container.RegisterDecorator<ITest1, TestDecorator1>();
container.RegisterDecorator<ITest1, TestDecorator2>();

var test = container.Resolve<ITest1>();

Assert.IsInstanceOfType(test, typeof(TestDecorator2));
Assert.IsInstanceOfType(test.Test, typeof(TestDecorator1));
Assert.IsInstanceOfType(test.Test.Test, typeof(Test1));

container.ReMapDecorator(typeof(ITest1), typeof(TestDecorator3), context => context.WithoutDisposalTracking());

test = container.Resolve<ITest1>();

Assert.IsInstanceOfType(test, typeof(TestDecorator3));
Assert.IsInstanceOfType(test.Test, typeof(Test1));
}
}

[TestMethod]
public void DecoratorTests_Service_ImplementationType()
{
Expand Down
34 changes: 34 additions & 0 deletions src/stashbox.tests/ReMapTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,30 @@ public void ReMapTests_DependencyResolve()
Assert.IsInstanceOfType(test22.Test1, typeof(Test11));
}

[TestMethod]
public void ReMapTests_DependencyResolve_WithoutService()
{
IStashboxContainer container = new StashboxContainer();
container.RegisterSingleton<Test11>();
container.RegisterType<Test3>();

var inst = container.Resolve<Test3>();

var dep = inst.Test1;

Assert.IsNotNull(dep);
Assert.IsInstanceOfType(dep, typeof(Test11));

container.ReMap<Test11>();

inst = container.Resolve<Test3>();

Assert.IsNotNull(inst.Test1);
Assert.IsInstanceOfType(inst.Test1, typeof(Test11));

Assert.AreNotSame(dep, inst.Test1);
}

[TestMethod]
public void ReMapTests_DependencyResolve_Fluent()
{
Expand Down Expand Up @@ -228,5 +252,15 @@ public Test2(ITest1 test1)
this.Test1 = test1;
}
}

public class Test3
{
public Test11 Test1 { get; }

public Test3(Test11 test1)
{
this.Test1 = test1;
}
}
}
}

0 comments on commit e206ce2

Please sign in to comment.