// Copyright (c) 2007 Omer Rauchwerger (a.k.a rauchy) (omer@rauchy.net)
// All rights reserved.
//
// This file is part of Regionerate.
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace Rauchy.Regionerate.Shared.Components.Rendering.Tests
{
[ TestFixture ]
public sealed class CommentRegionRendererTests : RegionRendererTests
{
#region Helper Methods (4)
// [rgn] Protected Methods (4)
protected override RegionRenderer CreateConcreteRenderer( CodeLayout.Configuration configuration )
{
return new CommentRegionRenderer( configuration );
}
///
/// Extracts the lines that are not region headers or footers.
///
protected override IList ExtractBody( IList lines )
{
// Return everything but the first couple of lines (// comment and pad) and the last line (pad)
IList body = new List();
for ( int i = 2; i < lines.Count - 1; i++ )
{
body.Add( lines[ i ] );
}
return body;
}
protected override void VerifyFooter( IList lines, CodeLayout.RenderingOptions renderingOptions ) { }
protected override void VerifyHeader( IList lines, int? expectedChildrenCount, CodeLayout.RenderingOptions renderingOptions )
{
string expected = string.Format("{0}// {1}{2}{3}", TextUtilities.GetTabString( renderingOptions ),
RegionTitle,
expectedChildrenCount != null
? string.Format( " ({0})", expectedChildrenCount )
: null, Environment.NewLine );
Assert.AreEqual( expected, lines[ 0 ] );
}
#endregion Helper Methods
}
}