/src/UnitTests/Reflection/DuckTypingTests.cs
http://github.com/philiplaureano/LinFu · C# · 30 lines · 24 code · 5 blank · 1 comment · 0 complexity · 0ffa8519acf642cfea8170490b7ba5d4 MD5 · raw file
- using LinFu.IoC;
- using LinFu.Proxy;
- using Moq;
- using Xunit;
- using SampleLibrary;
- using SampleLibrary.IOC;
- namespace LinFu.UnitTests.Reflection
- {
- public class DuckTypingTests
- {
- [Fact]
- public void ShouldBeAbleToRedirectInterfaceCallToTarget()
- {
- var container = new ServiceContainer();
- container.LoadFromBaseDirectory("*.dll");
- // The duck should call the implementation instance
- var mock = new Mock<SampleDuckTypeImplementation>();
- mock.Expect(i => i.DoSomething());
- object target = mock.Object;
- var sampleService = target.CreateDuck<ISampleService>();
- sampleService.DoSomething();
- mock.VerifyAll();
- }
- }
- }