Browse Source

WIP on Unit Tests

newNRvisualizers
Siegfried Pammer 14 years ago
parent
commit
c0548cc328
  1. 1139
      SharpDevelop.Tests.sln
  2. 14
      src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj
  3. 33
      src/AddIns/Misc/SearchAndReplace/Test/FindNextWithCursorAtEndTestFixture.cs
  4. 14
      src/AddIns/Misc/SearchAndReplace/Test/SearchAndReplace.Tests.csproj
  5. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/ChangeTrackingTest.cs
  6. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextAnchorTest.cs
  7. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextSegmentTreeTest.cs
  8. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextUtilitiesTests.cs
  9. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Editing/ChangeDocumentTests.cs
  10. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj
  11. 2
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CaretNavigationTests.cs

1139
SharpDevelop.Tests.sln

File diff suppressed because it is too large Load Diff

14
src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj

@ -48,6 +48,10 @@ @@ -48,6 +48,10 @@
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="Rhino.Mocks">
<HintPath>..\..\..\..\Libraries\RhinoMocks\Rhino.Mocks.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -76,6 +80,16 @@ @@ -76,6 +80,16 @@
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
<Name>ICSharpCode.AvalonEdit</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj">
<Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project>
<Name>ICSharpCode.NRefactory.CSharp</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>

33
src/AddIns/Misc/SearchAndReplace/Test/FindNextWithCursorAtEndTestFixture.cs

@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using ICSharpCode.AvalonEdit.Search;
using ICSharpCode.SharpDevelop.Editor.Search;
using System;
using ICSharpCode.AvalonEdit.Search;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop.Editor.Search;
using NUnit.Framework;
using SearchAndReplace;
using SearchAndReplace.Tests.Utils;
using Rhino.Mocks;
namespace SearchAndReplace.Tests
{
/// <summary>
/// SD2-857 - The search fails to find a string if the cursor is
/// SD2-857 - The search fails to find a string if the cursor is
/// positioned at the end of the last line. For example, if the
/// text editor has the text:
/// "foo"
/// without the quotes and no newline after this text, then
/// putting the cursor at the end after the last 'o' and
/// opening the search dialog and doing a find next for 'foo'
/// putting the cursor at the end after the last 'o' and
/// opening the search dialog and doing a find next for 'foo'
/// the string is not found.
/// </summary>
[TestFixture]
@ -41,31 +41,36 @@ namespace SearchAndReplace.Tests @@ -41,31 +41,36 @@ namespace SearchAndReplace.Tests
SearchOptions.MatchWholeWord = false;
// Create the document to be searched.
MockDocument doc = new MockDocument();
var doc = MockRepository.GenerateStub<IDocument>();
doc.Text = "foo";
doc.Stub(d => d.TextLength).Return(doc.Text.Length);
var location = MockRepository.GenerateStub<SearchLocation>(SearchOptions.SearchTarget, SearchOptions.LookIn, SearchOptions.LookInFiletypes, SearchOptions.IncludeSubdirectories, SearchOptions.SearchTarget == SearchTarget.CurrentSelection ? SearchManager.GetActiveSelection(true) : null);
location.Stub(l => l.GenerateFileList()).Return(new[] { new FileName(@"C:\Temp\test.txt") });
// Create a doc info with an initial end offset right
// Create a doc info with an initial end offset right
// at the end of the text.
ProvidedDocumentInformation docInfo = new ProvidedDocumentInformation(doc, @"C:\Temp\test.txt", doc.TextLength);
// Search the document.
// result = SearchManager.FindNext(SearchOptions.CurrentFindPattern, !SearchOptions.MatchCase, SearchOptions.MatchWholeWord, SearchMode.Normal,
// );
var strategy = SearchStrategyFactory.Create(SearchOptions.FindPattern, !SearchOptions.MatchCase, SearchOptions.MatchWholeWord, SearchOptions.SearchMode);
result = SearchManager.FindNext(strategy, location);
}
[Test, Ignore]
[Test]
public void FoundMatch()
{
Assert.IsNotNull(result);
}
[Test, Ignore]
[Test]
public void FoundTextOffset()
{
Assert.AreEqual(0, result.StartOffset);
}
[Test, Ignore]
[Test]
public void FoundTextLength()
{
Assert.AreEqual(3, result.Length);

14
src/AddIns/Misc/SearchAndReplace/Test/SearchAndReplace.Tests.csproj

@ -40,6 +40,10 @@ @@ -40,6 +40,10 @@
<Reference Include="nunit.framework">
<HintPath>..\..\..\..\Tools\NUnit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks">
<HintPath>..\..\..\..\Libraries\RhinoMocks\Rhino.Mocks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@ -52,6 +56,11 @@ @@ -52,6 +56,11 @@
<Name>ICSharpCode.AvalonEdit</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name>
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
@ -64,15 +73,10 @@ @@ -64,15 +73,10 @@
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
</ProjectReference>
<ProjectReference Include="..\Project\SearchAndReplace.csproj">
<Project>{9196DD8A-B4D4-4780-8742-C5762E547FC2}</Project>
<Name>SearchAndReplace</Name>
</ProjectReference>
<Compile Include="FindNextWithCursorAtEndTestFixture.cs" />
<Compile Include="MockDocument.cs" />
</ItemGroup>
</Project>

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/ChangeTrackingTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.Linq;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory.Editor;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit.Document

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextAnchorTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory.Editor;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit.Document

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextSegmentTreeTest.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory.Editor;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit.Document

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Document/TextUtilitiesTests.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory.Editor;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit.Document

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Editing/ChangeDocumentTests.cs

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using System;
using System.Text;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit.Editing

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/ICSharpCode.AvalonEdit.Tests.csproj

@ -99,9 +99,9 @@ @@ -99,9 +99,9 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.Editor\ICSharpCode.Editor.csproj">
<Project>{F054A788-B591-4561-A8BA-AE745BBEB817}</Project>
<Name>ICSharpCode.Editor</Name>
<ProjectReference Include="..\..\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name>
</ProjectReference>
<ProjectReference Include="..\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>

2
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CaretNavigationTests.cs

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
using System;
using System.Windows.Documents;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.Editor;
using ICSharpCode.NRefactory.Editor;
using NUnit.Framework;
namespace ICSharpCode.AvalonEdit.Utils

Loading…
Cancel
Save