コード例 #1
0
        public void WriteTypeSymbols(Type type)
        {
            string expectedResourceQualifier = $@"Content\UnitTests\{type.Name}";

            TsTypeManager  manager      = new TsTypeManager();
            MemoryFileSink fileSink     = new MemoryFileSink();
            TsSymbolWriter symbolWriter = new TsSymbolWriter(fileSink);

            IReadOnlyList <Type>         discoveredTypes = manager.DiscoverTypes(type);
            IReadOnlyList <TsTypeSymbol> symbols         = manager.ResolveTypeSymbols(discoveredTypes);

            symbolWriter.WriteSymbols(symbols);

            IFileSource fileSource = AssemblyResourceFileSource.WithResourceQualifier(
                typeof(TsSymbolWriterTests).Assembly, expectedResourceQualifier);

            try
            {
                fileSource.AssertSameSource(fileSink.ToSource());
            }
            catch
            {
                IFileSink debugFileSink = new DirectoryFileSink(Path.Combine(testTempPath, expectedResourceQualifier));
                fileSink.CopyTo(debugFileSink);
                throw;
            }
        }
コード例 #2
0
        public void CopyToTest()
        {
            IFileSource fileSource = AssemblyResourceFileSource.WithResourceQualifier(typeof(IFileSourceTests).Assembly, @"Content\ReferenceProject");

            IFileSink fileSink = new MemoryFileSink();

            fileSource.CopyTo(fileSink);

            fileSource.AssertSameSource(fileSink.ToSource());
        }