Browse Source

Move file service code in IronPython and IronRuby addins to common Scripting project.

pull/1/head
mrward 16 years ago
parent
commit
7767977b32
  1. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj
  2. 23
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonFileService.cs
  3. 38
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFileService.cs
  4. 7
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestDebugger.cs
  5. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunner.cs
  6. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerApplication.cs
  7. 11
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerContext.cs
  8. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
  9. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs
  10. 4
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs
  11. 65
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockPythonFileService.cs
  12. 67
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/MockPythonFileServiceTestFixture.cs
  13. 2
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.csproj
  14. 7
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestDebugger.cs
  15. 6
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunner.cs
  16. 4
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerApplication.cs
  17. 9
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerContext.cs
  18. 3
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj
  19. 4
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs
  20. 2
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs
  21. 4
      src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs
  22. 7
      src/AddIns/BackendBindings/Scripting/Project/ICSharpCode.Scripting.csproj
  23. 5
      src/AddIns/BackendBindings/Scripting/Project/Src/IScriptingFileService.cs
  24. 5
      src/AddIns/BackendBindings/Scripting/Project/Src/ScriptingFileService.cs
  25. 6
      src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj
  26. 5
      src/AddIns/BackendBindings/Scripting/Test/Utils/MockScriptingFileService.cs
  27. 9
      src/AddIns/BackendBindings/Scripting/Test/Utils/Tests/MockScriptingFileServiceTests.cs

2
src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.csproj

@ -90,7 +90,6 @@
<Compile Include="Src\CompilingOptionsPanel.cs" /> <Compile Include="Src\CompilingOptionsPanel.cs" />
<Compile Include="Src\IPythonConsole.cs" /> <Compile Include="Src\IPythonConsole.cs" />
<Compile Include="Src\IPythonConsolePad.cs" /> <Compile Include="Src\IPythonConsolePad.cs" />
<Compile Include="Src\IPythonFileService.cs" />
<Compile Include="Src\IPythonResolver.cs" /> <Compile Include="Src\IPythonResolver.cs" />
<Compile Include="Src\IPythonWorkbench.cs" /> <Compile Include="Src\IPythonWorkbench.cs" />
<Compile Include="Src\MemberName.cs" /> <Compile Include="Src\MemberName.cs" />
@ -98,7 +97,6 @@
<Compile Include="Src\PythonClassResolver.cs" /> <Compile Include="Src\PythonClassResolver.cs" />
<Compile Include="Src\PythonConsoleApplication.cs" /> <Compile Include="Src\PythonConsoleApplication.cs" />
<Compile Include="Src\PythonDotNetMethodResolver.cs" /> <Compile Include="Src\PythonDotNetMethodResolver.cs" />
<Compile Include="Src\PythonFileService.cs" />
<Compile Include="Src\PythonFromImport.cs" /> <Compile Include="Src\PythonFromImport.cs" />
<Compile Include="Src\PythonImport.cs" /> <Compile Include="Src\PythonImport.cs" />
<Compile Include="Src\PythonLanguageBinding.cs" /> <Compile Include="Src\PythonLanguageBinding.cs" />

23
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/IPythonFileService.cs

@ -1,23 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding
{
public interface IPythonFileService : IFileSystem
{
string GetTempFileName();
TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo);
void DeleteFile(string fileName);
}
}

38
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFileService.cs

@ -1,38 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.Scripting;
namespace ICSharpCode.PythonBinding
{
public class PythonFileService : IPythonFileService
{
public string GetTempFileName()
{
return Path.GetTempFileName();
}
public TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo)
{
return createTextWriterInfo.CreateTextWriter();
}
public void DeleteFile(string fileName)
{
File.Delete(fileName);
}
public bool FileExists(string fileName)
{
return File.Exists(fileName);
}
}
}

7
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestDebugger.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding namespace ICSharpCode.PythonBinding
@ -14,7 +15,7 @@ namespace ICSharpCode.PythonBinding
public class PythonTestDebugger : TestDebuggerBase public class PythonTestDebugger : TestDebuggerBase
{ {
PythonAddInOptions options; PythonAddInOptions options;
IPythonFileService fileService; IScriptingFileService fileService;
PythonTestRunnerApplication testRunnerApplication; PythonTestRunnerApplication testRunnerApplication;
PythonStandardLibraryPath pythonStandardLibraryPath; PythonStandardLibraryPath pythonStandardLibraryPath;
@ -24,7 +25,7 @@ namespace ICSharpCode.PythonBinding
new TestResultsMonitor(), new TestResultsMonitor(),
new PythonAddInOptions(), new PythonAddInOptions(),
new PythonStandardLibraryPath(), new PythonStandardLibraryPath(),
new PythonFileService()) new ScriptingFileService())
{ {
} }
@ -33,7 +34,7 @@ namespace ICSharpCode.PythonBinding
ITestResultsMonitor testResultsMonitor, ITestResultsMonitor testResultsMonitor,
PythonAddInOptions options, PythonAddInOptions options,
PythonStandardLibraryPath pythonStandardLibraryPath, PythonStandardLibraryPath pythonStandardLibraryPath,
IPythonFileService fileService) IScriptingFileService fileService)
: base(debuggerService, messageService, testResultsMonitor) : base(debuggerService, messageService, testResultsMonitor)
{ {
this.options = options; this.options = options;

6
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunner.cs

@ -9,8 +9,10 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.Core.Services; using ICSharpCode.Core.Services;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding namespace ICSharpCode.PythonBinding
@ -19,7 +21,7 @@ namespace ICSharpCode.PythonBinding
{ {
PythonAddInOptions options; PythonAddInOptions options;
PythonStandardLibraryPath pythonStandardLibraryPath; PythonStandardLibraryPath pythonStandardLibraryPath;
IPythonFileService fileService; IScriptingFileService fileService;
PythonTestRunnerApplication testRunnerApplication; PythonTestRunnerApplication testRunnerApplication;
public PythonTestRunner() public PythonTestRunner()
@ -32,7 +34,7 @@ namespace ICSharpCode.PythonBinding
{ {
this.options = context.Options; this.options = context.Options;
this.pythonStandardLibraryPath = context.PythonStandardLibraryPath; this.pythonStandardLibraryPath = context.PythonStandardLibraryPath;
this.fileService = context.PythonFileService; this.fileService = context.ScriptingFileService;
} }
public override void Start(SelectedTests selectedTests) public override void Start(SelectedTests selectedTests)

4
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerApplication.cs

@ -22,14 +22,14 @@ namespace ICSharpCode.PythonBinding
PythonAddInOptions options; PythonAddInOptions options;
PythonStandardLibraryPath pythonStandardLibraryPath; PythonStandardLibraryPath pythonStandardLibraryPath;
PythonTestRunnerResponseFile responseFile; PythonTestRunnerResponseFile responseFile;
IPythonFileService fileService; IScriptingFileService fileService;
CreateTextWriterInfo textWriterInfo; CreateTextWriterInfo textWriterInfo;
PythonConsoleApplication consoleApplication; PythonConsoleApplication consoleApplication;
public PythonTestRunnerApplication(string testResultsFileName, public PythonTestRunnerApplication(string testResultsFileName,
PythonAddInOptions options, PythonAddInOptions options,
PythonStandardLibraryPath pythonStandardLibraryPath, PythonStandardLibraryPath pythonStandardLibraryPath,
IPythonFileService fileService) IScriptingFileService fileService)
{ {
this.testResultsFileName = testResultsFileName; this.testResultsFileName = testResultsFileName;
this.options = options; this.options = options;

11
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonTestRunnerContext.cs

@ -6,6 +6,7 @@
// </file> // </file>
using System; using System;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.PythonBinding namespace ICSharpCode.PythonBinding
@ -14,14 +15,14 @@ namespace ICSharpCode.PythonBinding
{ {
PythonAddInOptions options; PythonAddInOptions options;
PythonStandardLibraryPath pythonStandardLibraryPath; PythonStandardLibraryPath pythonStandardLibraryPath;
IPythonFileService fileService; IScriptingFileService fileService;
public PythonTestRunnerContext(IUnitTestProcessRunner processRunner, public PythonTestRunnerContext(IUnitTestProcessRunner processRunner,
ITestResultsMonitor testResultsMonitor, ITestResultsMonitor testResultsMonitor,
IUnitTestMessageService messageService, IUnitTestMessageService messageService,
PythonAddInOptions options, PythonAddInOptions options,
PythonStandardLibraryPath pythonStandardLibraryPath, PythonStandardLibraryPath pythonStandardLibraryPath,
IPythonFileService fileService) IScriptingFileService fileService)
: base(processRunner, testResultsMonitor, fileService, messageService) : base(processRunner, testResultsMonitor, fileService, messageService)
{ {
this.options = options; this.options = options;
@ -35,7 +36,7 @@ namespace ICSharpCode.PythonBinding
new UnitTestMessageService(), new UnitTestMessageService(),
new PythonAddInOptions(), new PythonAddInOptions(),
new PythonStandardLibraryPath(), new PythonStandardLibraryPath(),
new PythonFileService()) new ScriptingFileService())
{ {
} }
@ -47,8 +48,8 @@ namespace ICSharpCode.PythonBinding
get { return pythonStandardLibraryPath; } get { return pythonStandardLibraryPath; }
} }
public IPythonFileService PythonFileService { public IScriptingFileService ScriptingFileService {
get { return base.FileSystem as IPythonFileService; } get { return base.FileSystem as IScriptingFileService; }
} }
} }
} }

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj

@ -438,7 +438,6 @@
<Compile Include="Utils\MockDesignerGenerator.cs" /> <Compile Include="Utils\MockDesignerGenerator.cs" />
<Compile Include="Utils\MockPythonConsole.cs" /> <Compile Include="Utils\MockPythonConsole.cs" />
<Compile Include="Utils\MockPythonConsolePad.cs" /> <Compile Include="Utils\MockPythonConsolePad.cs" />
<Compile Include="Utils\MockPythonFileService.cs" />
<Compile Include="Utils\MockWorkbench.cs" /> <Compile Include="Utils\MockWorkbench.cs" />
<Compile Include="Utils\PythonMSBuildEngineHelper.cs" /> <Compile Include="Utils\PythonMSBuildEngineHelper.cs" />
<Compile Include="Utils\TestablePythonConsole.cs" /> <Compile Include="Utils\TestablePythonConsole.cs" />
@ -450,7 +449,6 @@
<Compile Include="Utils\PythonBindingAddInFile.cs" /> <Compile Include="Utils\PythonBindingAddInFile.cs" />
<Compile Include="Utils\PythonCompletionItemsHelper.cs" /> <Compile Include="Utils\PythonCompletionItemsHelper.cs" />
<Compile Include="Utils\PythonParserHelper.cs" /> <Compile Include="Utils\PythonParserHelper.cs" />
<Compile Include="Utils\Tests\MockPythonFileServiceTestFixture.cs" />
<Compile Include="Utils\Tests\PythonCompletionItemsHelperTests.cs" /> <Compile Include="Utils\Tests\PythonCompletionItemsHelperTests.cs" />
<Compile Include="Utils\Tests\PythonParserHelperTests.cs" /> <Compile Include="Utils\Tests\PythonParserHelperTests.cs" />
<EmbeddedResource Include="Designer\App.ico" /> <EmbeddedResource Include="Designer\App.ico" />

4
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs

@ -33,7 +33,7 @@ namespace PythonBinding.Tests.Testing
SelectedTests selectedTests; SelectedTests selectedTests;
MockMethod methodToTest; MockMethod methodToTest;
PythonAddInOptions options; PythonAddInOptions options;
MockPythonFileService fileService; MockScriptingFileService fileService;
StringBuilder responseFileText; StringBuilder responseFileText;
StringWriter responseFileStringWriter; StringWriter responseFileStringWriter;
PythonStandardLibraryPath standardLibraryPath; PythonStandardLibraryPath standardLibraryPath;
@ -54,7 +54,7 @@ namespace PythonBinding.Tests.Testing
options = new PythonAddInOptions(new Properties()); options = new PythonAddInOptions(new Properties());
options.PythonFileName = @"c:\ironpython\ipy.exe"; options.PythonFileName = @"c:\ironpython\ipy.exe";
standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib"); standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib");
fileService = new MockPythonFileService(); fileService = new MockScriptingFileService();
testDebugger = new PythonTestDebugger(debuggerService, messageService, testResultsMonitor, options, standardLibraryPath, fileService); testDebugger = new PythonTestDebugger(debuggerService, messageService, testResultsMonitor, options, standardLibraryPath, fileService);
} }

4
src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs

@ -32,7 +32,7 @@ namespace PythonBinding.Tests.Testing
SelectedTests selectedTests; SelectedTests selectedTests;
MockMethod methodToTest; MockMethod methodToTest;
PythonAddInOptions options; PythonAddInOptions options;
MockPythonFileService fileService; MockScriptingFileService fileService;
StringBuilder responseFileText; StringBuilder responseFileText;
StringWriter responseFileStringWriter; StringWriter responseFileStringWriter;
PythonStandardLibraryPath standardLibraryPath; PythonStandardLibraryPath standardLibraryPath;
@ -51,7 +51,7 @@ namespace PythonBinding.Tests.Testing
testResultsMonitor = new MockTestResultsMonitor(); testResultsMonitor = new MockTestResultsMonitor();
options = new PythonAddInOptions(new Properties()); options = new PythonAddInOptions(new Properties());
options.PythonFileName = @"c:\ironpython\ipy.exe"; options.PythonFileName = @"c:\ironpython\ipy.exe";
fileService = new MockPythonFileService(); fileService = new MockScriptingFileService();
messageService = new MockMessageService(); messageService = new MockMessageService();
standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib"); standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib");
PythonTestRunnerContext context = new PythonTestRunnerContext(processRunner, PythonTestRunnerContext context = new PythonTestRunnerContext(processRunner,

65
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockPythonFileService.cs

@ -1,65 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.PythonBinding;
using ICSharpCode.Scripting;
namespace PythonBinding.Tests.Utils
{
public class MockPythonFileService : IPythonFileService
{
CreateTextWriterInfo createTextWriterInfoPassedToCreateTextWriter;
string tempFileName;
TextWriter textWriter;
string fileNameDeleted;
public void SetTempFileName(string fileName)
{
this.tempFileName = fileName;
}
public string GetTempFileName()
{
return tempFileName;
}
public void SetTextWriter(TextWriter writer)
{
this.textWriter = writer;
}
public TextWriter CreateTextWriter(CreateTextWriterInfo textWriterInfo)
{
createTextWriterInfoPassedToCreateTextWriter = textWriterInfo;
return textWriter;
}
public CreateTextWriterInfo CreateTextWriterInfoPassedToCreateTextWriter {
get { return createTextWriterInfoPassedToCreateTextWriter; }
set { createTextWriterInfoPassedToCreateTextWriter = value; }
}
public void DeleteFile(string fileName)
{
fileNameDeleted = fileName;
}
public string FileNameDeleted {
get { return fileNameDeleted; }
set { fileNameDeleted = value; }
}
public bool FileExists(string fileName)
{
return true;
}
}
}

67
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/MockPythonFileServiceTestFixture.cs

@ -1,67 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Text;
using ICSharpCode.PythonBinding;
using ICSharpCode.Scripting;
using NUnit.Framework;
namespace PythonBinding.Tests.Utils.Tests
{
[TestFixture]
public class MockPythonFileServiceTestFixture
{
MockPythonFileService fileService;
[SetUp]
public void Init()
{
fileService = new MockPythonFileService();
}
[Test]
public void GetTempFileNameReturnsReturnsTemporaryFileName()
{
string expectedFileName = @"c:\temp\tmp1.tmp";
fileService.SetTempFileName(expectedFileName);
string tempFileName = fileService.GetTempFileName();
Assert.AreEqual(expectedFileName, tempFileName);
}
[Test]
public void TextWriterReturnedFromCreateTextWriter()
{
using (StringWriter stringWriter = new StringWriter(new StringBuilder())) {
fileService.SetTextWriter(stringWriter);
CreateTextWriterInfo info = new CreateTextWriterInfo(@"test.tmp", Encoding.UTF8, true);
Assert.AreEqual(stringWriter, fileService.CreateTextWriter(info));
}
}
[Test]
public void CreateTextWriterInfoIsSavedWhenCreateTextWriterMethodIsCalled()
{
fileService.CreateTextWriterInfoPassedToCreateTextWriter = null;
CreateTextWriterInfo info = new CreateTextWriterInfo("test.txt", Encoding.UTF8, true);
fileService.CreateTextWriter(info);
Assert.AreEqual(info, fileService.CreateTextWriterInfoPassedToCreateTextWriter);
}
[Test]
public void DeleteFileSavesFileNameDeleted()
{
fileService.FileNameDeleted = null;
string expectedFileName = @"c:\temp\tmp66.tmp";
fileService.DeleteFile(expectedFileName);
Assert.AreEqual(expectedFileName, fileService.FileNameDeleted);
}
}
}

2
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.csproj

@ -88,7 +88,6 @@
<Compile Include="Configuration\AssemblyInfo.cs" /> <Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\IRubyConsole.cs" /> <Compile Include="Src\IRubyConsole.cs" />
<Compile Include="Src\IRubyConsolePad.cs" /> <Compile Include="Src\IRubyConsolePad.cs" />
<Compile Include="Src\IRubyFileService.cs" />
<Compile Include="Src\IRubyWorkbench.cs" /> <Compile Include="Src\IRubyWorkbench.cs" />
<Compile Include="Src\RubyConsoleApplication.cs" /> <Compile Include="Src\RubyConsoleApplication.cs" />
<Compile Include="Src\ConvertProjectToRubyProjectCommand.cs" /> <Compile Include="Src\ConvertProjectToRubyProjectCommand.cs" />
@ -110,7 +109,6 @@
<Compile Include="Src\RubyDesignerGenerator.cs" /> <Compile Include="Src\RubyDesignerGenerator.cs" />
<Compile Include="Src\RubyDesignerLoader.cs" /> <Compile Include="Src\RubyDesignerLoader.cs" />
<Compile Include="Src\RubyDesignerLoaderProvider.cs" /> <Compile Include="Src\RubyDesignerLoaderProvider.cs" />
<Compile Include="Src\RubyFileService.cs" />
<Compile Include="Src\RubyFormattingStrategy.cs" /> <Compile Include="Src\RubyFormattingStrategy.cs" />
<Compile Include="Src\RubyFormsDesignerDisplayBinding.cs" /> <Compile Include="Src\RubyFormsDesignerDisplayBinding.cs" />
<Compile Include="Src\RubyLanguageBinding.cs" /> <Compile Include="Src\RubyLanguageBinding.cs" />

7
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestDebugger.cs

@ -8,6 +8,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using ICSharpCode.Core.Services; using ICSharpCode.Core.Services;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.RubyBinding namespace ICSharpCode.RubyBinding
@ -15,7 +16,7 @@ namespace ICSharpCode.RubyBinding
public class RubyTestDebugger : TestDebuggerBase public class RubyTestDebugger : TestDebuggerBase
{ {
RubyAddInOptions options; RubyAddInOptions options;
IRubyFileService fileService; IScriptingFileService fileService;
RubyTestRunnerApplication testRunnerApplication; RubyTestRunnerApplication testRunnerApplication;
public RubyTestDebugger() public RubyTestDebugger()
@ -23,7 +24,7 @@ namespace ICSharpCode.RubyBinding
new UnitTestMessageService(), new UnitTestMessageService(),
new TestResultsMonitor(), new TestResultsMonitor(),
new RubyAddInOptions(), new RubyAddInOptions(),
new RubyFileService()) new ScriptingFileService())
{ {
} }
@ -31,7 +32,7 @@ namespace ICSharpCode.RubyBinding
IUnitTestMessageService messageService, IUnitTestMessageService messageService,
ITestResultsMonitor testResultsMonitor, ITestResultsMonitor testResultsMonitor,
RubyAddInOptions options, RubyAddInOptions options,
IRubyFileService fileService) IScriptingFileService fileService)
: base(debuggerService, messageService, testResultsMonitor) : base(debuggerService, messageService, testResultsMonitor)
{ {
this.options = options; this.options = options;

6
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunner.cs

@ -9,7 +9,9 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.RubyBinding namespace ICSharpCode.RubyBinding
@ -17,7 +19,7 @@ namespace ICSharpCode.RubyBinding
public class RubyTestRunner : TestProcessRunnerBase public class RubyTestRunner : TestProcessRunnerBase
{ {
RubyAddInOptions options; RubyAddInOptions options;
IRubyFileService fileService; IScriptingFileService fileService;
RubyTestRunnerApplication testRunnerApplication; RubyTestRunnerApplication testRunnerApplication;
public RubyTestRunner() public RubyTestRunner()
@ -29,7 +31,7 @@ namespace ICSharpCode.RubyBinding
: base(context) : base(context)
{ {
this.options = context.Options; this.options = context.Options;
this.fileService = context.RubyFileService; this.fileService = context.ScriptingFileService;
context.TestResultsMonitor.InitialFilePosition = 0; context.TestResultsMonitor.InitialFilePosition = 0;
} }

4
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerApplication.cs

@ -22,14 +22,14 @@ namespace ICSharpCode.RubyBinding
string testResultsFileName = String.Empty; string testResultsFileName = String.Empty;
RubyAddInOptions options; RubyAddInOptions options;
RubyTestRunnerResponseFile responseFile; RubyTestRunnerResponseFile responseFile;
IRubyFileService fileService; IScriptingFileService fileService;
CreateTextWriterInfo textWriterInfo; CreateTextWriterInfo textWriterInfo;
RubyConsoleApplication consoleApplication; RubyConsoleApplication consoleApplication;
StringBuilder arguments; StringBuilder arguments;
public RubyTestRunnerApplication(string testResultsFileName, public RubyTestRunnerApplication(string testResultsFileName,
RubyAddInOptions options, RubyAddInOptions options,
IRubyFileService fileService) IScriptingFileService fileService)
{ {
this.testResultsFileName = testResultsFileName; this.testResultsFileName = testResultsFileName;
this.options = options; this.options = options;

9
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerContext.cs

@ -6,6 +6,7 @@
// </file> // </file>
using System; using System;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.RubyBinding namespace ICSharpCode.RubyBinding
@ -13,13 +14,13 @@ namespace ICSharpCode.RubyBinding
public class RubyTestRunnerContext : TestProcessRunnerBaseContext public class RubyTestRunnerContext : TestProcessRunnerBaseContext
{ {
RubyAddInOptions options; RubyAddInOptions options;
IRubyFileService fileService; IScriptingFileService fileService;
public RubyTestRunnerContext() public RubyTestRunnerContext()
: this(new UnitTestProcessRunner(), : this(new UnitTestProcessRunner(),
new TestResultsMonitor(), new TestResultsMonitor(),
new RubyAddInOptions(), new RubyAddInOptions(),
new RubyFileService(), new ScriptingFileService(),
new UnitTestMessageService()) new UnitTestMessageService())
{ {
} }
@ -27,7 +28,7 @@ namespace ICSharpCode.RubyBinding
public RubyTestRunnerContext(IUnitTestProcessRunner processRunner, public RubyTestRunnerContext(IUnitTestProcessRunner processRunner,
ITestResultsMonitor testResultsMonitor, ITestResultsMonitor testResultsMonitor,
RubyAddInOptions options, RubyAddInOptions options,
IRubyFileService fileService, IScriptingFileService fileService,
IUnitTestMessageService messageService) IUnitTestMessageService messageService)
: base(processRunner, testResultsMonitor, fileService, messageService) : base(processRunner, testResultsMonitor, fileService, messageService)
{ {
@ -39,7 +40,7 @@ namespace ICSharpCode.RubyBinding
get { return options; } get { return options; }
} }
public IRubyFileService RubyFileService { public IScriptingFileService ScriptingFileService {
get { return fileService; } get { return fileService; }
} }
} }

3
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj

@ -332,14 +332,12 @@
<Compile Include="Utils\MockDesignerGenerator.cs" /> <Compile Include="Utils\MockDesignerGenerator.cs" />
<Compile Include="Utils\MockRubyConsole.cs" /> <Compile Include="Utils\MockRubyConsole.cs" />
<Compile Include="Utils\MockRubyConsolePad.cs" /> <Compile Include="Utils\MockRubyConsolePad.cs" />
<Compile Include="Utils\MockRubyFileService.cs" />
<Compile Include="Utils\MockWorkbench.cs" /> <Compile Include="Utils\MockWorkbench.cs" />
<Compile Include="Utils\RubyBindingAddInFile.cs" /> <Compile Include="Utils\RubyBindingAddInFile.cs" />
<Compile Include="Utils\RubyMSBuildEngineHelper.cs" /> <Compile Include="Utils\RubyMSBuildEngineHelper.cs" />
<Compile Include="Utils\RubyParserHelper.cs" /> <Compile Include="Utils\RubyParserHelper.cs" />
<Compile Include="Utils\RubySelectedTestsHelper.cs" /> <Compile Include="Utils\RubySelectedTestsHelper.cs" />
<Compile Include="Utils\TestableRubyConsole.cs" /> <Compile Include="Utils\TestableRubyConsole.cs" />
<Compile Include="Utils\Tests\MockRubyFileServiceTestFixture.cs" />
<EmbeddedResource Include="..\Project\RubyBinding.addin"> <EmbeddedResource Include="..\Project\RubyBinding.addin">
<Link>RubyBinding.addin</Link> <Link>RubyBinding.addin</Link>
</EmbeddedResource> </EmbeddedResource>
@ -349,7 +347,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Testing" /> <Folder Include="Testing" />
<Folder Include="Utils\Tests" />
<ProjectReference Include="..\..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj"> <ProjectReference Include="..\..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project> <Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project>
<Name>ICSharpCode.AvalonEdit</Name> <Name>ICSharpCode.AvalonEdit</Name>

4
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs

@ -33,7 +33,7 @@ namespace RubyBinding.Tests.Testing
SelectedTests selectedTests; SelectedTests selectedTests;
MockMethod methodToTest; MockMethod methodToTest;
RubyAddInOptions options; RubyAddInOptions options;
MockRubyFileService fileService; MockScriptingFileService fileService;
StringBuilder responseFileText; StringBuilder responseFileText;
StringWriter responseFileStringWriter; StringWriter responseFileStringWriter;
@ -53,7 +53,7 @@ namespace RubyBinding.Tests.Testing
testResultsMonitor.InitialFilePosition = 3; testResultsMonitor.InitialFilePosition = 3;
options = new RubyAddInOptions(new Properties()); options = new RubyAddInOptions(new Properties());
options.RubyFileName = @"c:\ironruby\ir.exe"; options.RubyFileName = @"c:\ironruby\ir.exe";
fileService = new MockRubyFileService(); fileService = new MockScriptingFileService();
testDebugger = new RubyTestDebugger(debuggerService, messageService, testResultsMonitor, options, fileService); testDebugger = new RubyTestDebugger(debuggerService, messageService, testResultsMonitor, options, fileService);
} }

2
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs

@ -32,7 +32,7 @@ namespace RubyBinding.Tests.Testing
public void Init() public void Init()
{ {
string tempFileName = "temp.tmp"; string tempFileName = "temp.tmp";
MockRubyFileService fileService = new MockRubyFileService(); MockScriptingFileService fileService = new MockScriptingFileService();
fileService.SetTempFileName(tempFileName); fileService.SetTempFileName(tempFileName);
fileService.SetTextWriter(new StringWriter()); fileService.SetTextWriter(new StringWriter());

4
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs

@ -32,7 +32,7 @@ namespace RubyBinding.Tests.Testing
SelectedTests selectedTests; SelectedTests selectedTests;
MockMethod methodToTest; MockMethod methodToTest;
RubyAddInOptions options; RubyAddInOptions options;
MockRubyFileService fileService; MockScriptingFileService fileService;
StringBuilder responseFileText; StringBuilder responseFileText;
StringWriter responseFileStringWriter; StringWriter responseFileStringWriter;
@ -50,7 +50,7 @@ namespace RubyBinding.Tests.Testing
testResultsMonitor.InitialFilePosition = 3; testResultsMonitor.InitialFilePosition = 3;
options = new RubyAddInOptions(new Properties()); options = new RubyAddInOptions(new Properties());
options.RubyFileName = @"c:\ironruby\ir.exe"; options.RubyFileName = @"c:\ironruby\ir.exe";
fileService = new MockRubyFileService(); fileService = new MockScriptingFileService();
MockMessageService messageService = new MockMessageService(); MockMessageService messageService = new MockMessageService();
RubyTestRunnerContext context = new RubyTestRunnerContext(processRunner, testResultsMonitor, options, fileService, messageService); RubyTestRunnerContext context = new RubyTestRunnerContext(processRunner, testResultsMonitor, options, fileService, messageService);

7
src/AddIns/BackendBindings/Scripting/Project/ICSharpCode.Scripting.csproj

@ -70,10 +70,12 @@
<Compile Include="Src\ILock.cs" /> <Compile Include="Src\ILock.cs" />
<Compile Include="Src\IMemberProvider.cs" /> <Compile Include="Src\IMemberProvider.cs" />
<Compile Include="Src\IScriptingConsoleTextEditor.cs" /> <Compile Include="Src\IScriptingConsoleTextEditor.cs" />
<Compile Include="Src\IScriptingFileService.cs" />
<Compile Include="Src\ScriptingConsoleCompletionData.cs" /> <Compile Include="Src\ScriptingConsoleCompletionData.cs" />
<Compile Include="Src\ScriptingConsoleCompletionDataProvider.cs" /> <Compile Include="Src\ScriptingConsoleCompletionDataProvider.cs" />
<Compile Include="Src\ScriptingConsoleTextEditor.cs" /> <Compile Include="Src\ScriptingConsoleTextEditor.cs" />
<Compile Include="Src\ScriptingConsoleTextEditorKeyEventArgs.cs" /> <Compile Include="Src\ScriptingConsoleTextEditorKeyEventArgs.cs" />
<Compile Include="Src\ScriptingFileService.cs" />
<Compile Include="Src\StringListLock.cs" /> <Compile Include="Src\StringListLock.cs" />
<Compile Include="Src\ThreadSafeScriptingConsoleTextEditor.cs" /> <Compile Include="Src\ThreadSafeScriptingConsoleTextEditor.cs" />
</ItemGroup> </ItemGroup>
@ -93,6 +95,11 @@
<Name>ICSharpCode.Core</Name> <Name>ICSharpCode.Core</Name>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Analysis\UnitTesting\UnitTesting.csproj">
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project>
<Name>UnitTesting</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project> </Project>

5
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/IRubyFileService.cs → src/AddIns/BackendBindings/Scripting/Project/Src/IScriptingFileService.cs

@ -9,12 +9,11 @@ using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ICSharpCode.Scripting;
using ICSharpCode.UnitTesting; using ICSharpCode.UnitTesting;
namespace ICSharpCode.RubyBinding namespace ICSharpCode.Scripting
{ {
public interface IRubyFileService : IFileSystem public interface IScriptingFileService : IFileSystem
{ {
string GetTempFileName(); string GetTempFileName();
TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo); TextWriter CreateTextWriter(CreateTextWriterInfo createTextWriterInfo);

5
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFileService.cs → src/AddIns/BackendBindings/Scripting/Project/Src/ScriptingFileService.cs

@ -8,11 +8,10 @@
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ICSharpCode.Scripting;
namespace ICSharpCode.RubyBinding namespace ICSharpCode.Scripting
{ {
public class RubyFileService : IRubyFileService public class ScriptingFileService : IScriptingFileService
{ {
public string GetTempFileName() public string GetTempFileName()
{ {

6
src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj

@ -110,6 +110,7 @@
<Compile Include="Utils\MockResourceReader.cs" /> <Compile Include="Utils\MockResourceReader.cs" />
<Compile Include="Utils\MockResourceService.cs" /> <Compile Include="Utils\MockResourceService.cs" />
<Compile Include="Utils\MockResourceWriter.cs" /> <Compile Include="Utils\MockResourceWriter.cs" />
<Compile Include="Utils\MockScriptingFileService.cs" />
<Compile Include="Utils\MockSite.cs" /> <Compile Include="Utils\MockSite.cs" />
<Compile Include="Utils\MockTextEditor.cs" /> <Compile Include="Utils\MockTextEditor.cs" />
<Compile Include="Utils\MockTextEditorOptions.cs" /> <Compile Include="Utils\MockTextEditorOptions.cs" />
@ -125,6 +126,7 @@
<Compile Include="Utils\Tests\MockControlDispatcherTestFixture.cs" /> <Compile Include="Utils\Tests\MockControlDispatcherTestFixture.cs" />
<Compile Include="Utils\Tests\MockEditableViewContentTestFixture.cs" /> <Compile Include="Utils\Tests\MockEditableViewContentTestFixture.cs" />
<Compile Include="Utils\Tests\MockProjectContentTests.cs" /> <Compile Include="Utils\Tests\MockProjectContentTests.cs" />
<Compile Include="Utils\Tests\MockScriptingFileServiceTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj"> <ProjectReference Include="..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj">
@ -151,6 +153,10 @@
<Project>{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}</Project> <Project>{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}</Project>
<Name>UnitTesting.Tests</Name> <Name>UnitTesting.Tests</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Analysis\UnitTesting\UnitTesting.csproj">
<Project>{1F261725-6318-4434-A1B1-6C70CE4CD324}</Project>
<Name>UnitTesting</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj"> <ProjectReference Include="..\..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj">
<Project>{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}</Project> <Project>{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}</Project>
<Name>FormsDesigner</Name> <Name>FormsDesigner</Name>

5
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/MockRubyFileService.cs → src/AddIns/BackendBindings/Scripting/Test/Utils/MockScriptingFileService.cs

@ -9,12 +9,11 @@ using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ICSharpCode.RubyBinding;
using ICSharpCode.Scripting; using ICSharpCode.Scripting;
namespace RubyBinding.Tests.Utils namespace ICSharpCode.Scripting.Tests.Utils
{ {
public class MockRubyFileService : IRubyFileService public class MockScriptingFileService : IScriptingFileService
{ {
CreateTextWriterInfo createTextWriterInfoPassedToCreateTextWriter; CreateTextWriterInfo createTextWriterInfoPassedToCreateTextWriter;
string tempFileName; string tempFileName;

9
src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/Tests/MockRubyFileServiceTestFixture.cs → src/AddIns/BackendBindings/Scripting/Test/Utils/Tests/MockScriptingFileServiceTests.cs

@ -9,21 +9,20 @@ using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ICSharpCode.RubyBinding;
using ICSharpCode.Scripting; using ICSharpCode.Scripting;
using NUnit.Framework; using NUnit.Framework;
namespace RubyBinding.Tests.Utils.Tests namespace ICSharpCode.Scripting.Tests.Utils.Tests
{ {
[TestFixture] [TestFixture]
public class MockRubyFileServiceTestFixture public class MockScriptingFileServiceTests
{ {
MockRubyFileService fileService; MockScriptingFileService fileService;
[SetUp] [SetUp]
public void Init() public void Init()
{ {
fileService = new MockRubyFileService(); fileService = new MockScriptingFileService();
} }
[Test] [Test]
Loading…
Cancel
Save