/src/UnitTests/Proxy/InterfaceExtractorTests.cs
http://github.com/philiplaureano/LinFu · C# · 32 lines · 26 code · 5 blank · 1 comment · 1 complexity · 045fc2832d76ebb4723a487fed311a07 MD5 · raw file
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using LinFu.Proxy;
- using Xunit;
- using SampleLibrary;
- namespace LinFu.UnitTests.Proxy
- {
- public class InterfaceExtractorTests
- {
- [Fact]
- public void InterfaceExtractorShouldReturnTheCorrectResults()
- {
- var baseType = typeof(SampleClass);
- var extractor = new InterfaceExtractor();
- var interfaces = new HashSet<Type>();
- extractor.GetInterfaces(baseType, interfaces);
- Assert.Contains(typeof(ISampleService), interfaces);
- Assert.Contains(typeof(ISampleGenericService<int>), interfaces);
- // The result list must only contain interface types
- var nonInterfaceTypes = from t in interfaces
- where !t.IsInterface
- select t;
- Assert.True(nonInterfaceTypes.Count() == 0);
- }
- }
- }