PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using LinFu.Proxy;
 5using Xunit;
 6using SampleLibrary;
 7
 8namespace LinFu.UnitTests.Proxy
 9{
10    public class InterfaceExtractorTests
11    {
12        [Fact]
13        public void InterfaceExtractorShouldReturnTheCorrectResults()
14        {
15            var baseType = typeof(SampleClass);
16            var extractor = new InterfaceExtractor();
17            var interfaces = new HashSet<Type>();
18
19            extractor.GetInterfaces(baseType, interfaces);
20
21            Assert.Contains(typeof(ISampleService), interfaces);
22            Assert.Contains(typeof(ISampleGenericService<int>), interfaces);
23
24            // The result list must only contain interface types
25            var nonInterfaceTypes = from t in interfaces
26                where !t.IsInterface
27                select t;
28
29            Assert.True(nonInterfaceTypes.Count() == 0);
30        }
31    }
32}