Permalink
Browse files

Moving to Xunit test framework

  • Loading branch information...
1 parent 332cb8f commit d446ed8c8deae15e956c63a96ab8b3052078d3c0 @ayende ayende committed Jan 5, 2010
Showing with 5,556 additions and 31,306 deletions.
  1. +8 −11 Rhino.DSL.Tests/AnonymousBaseClassTestFixture.cs
  2. +2 −3 Rhino.DSL.Tests/AutoImportTextFixture.cs
  3. +5 −6 Rhino.DSL.Tests/AutoReferenceFilesCompilerStepFixure.cs
  4. +4 −6 Rhino.DSL.Tests/BaseCompilerTestFixture.cs
  5. +2 −3 Rhino.DSL.Tests/BaseDslFixture.cs
  6. +12 −13 Rhino.DSL.Tests/BlockToArgumentsTestFixture.cs
  7. +2 −2 Rhino.DSL.Tests/ConsoleRecorder.cs
  8. +24 −27 Rhino.DSL.Tests/DslFactoryFixture/DslEngineFixture.cs
  9. +13 −18 Rhino.DSL.Tests/DslFactoryFixture/DslFactoryFixture.cs
  10. +4 −5 Rhino.DSL.Tests/DslFactoryFixture/DslFixtureIntegrationFixture.cs
  11. +27 −28 Rhino.DSL.Tests/ExternalDSL/ExternalDSLFixture.cs
  12. +10 −11 Rhino.DSL.Tests/FeaturesDSL/WithActionsDSLFixture.cs
  13. +14 −17 Rhino.DSL.Tests/MethodSubstitutionBaseClassTestFixture.cs
  14. +17 −18 Rhino.DSL.Tests/OrderDSL/OrderDSLFixture.cs
  15. +5 −6 Rhino.DSL.Tests/Rhino.DSL.Tests-v2008.csproj
  16. +0 −80 Rhino.DSL.Tests/SchedulingDSL/SchedulingDSLFixture.cs
  17. +8 −13 Rhino.DSL.Tests/TransformerCompilerStepTestFixture.cs
  18. +0 −26 Rhino.DSL.sln
  19. +0 −19 SharedLibs/Makefile.am
  20. BIN SharedLibs/MbUnit.Framework.dll
  21. BIN SharedLibs/xunit.dll
  22. BIN SharedLibs/xunit.extensions.dll
  23. +2,132 −0 SharedLibs/xunit.xml
  24. BIN Tools/MbUnit/Aggregate.dll
  25. BIN Tools/MbUnit/Aggregate.pdb
  26. BIN Tools/MbUnit/MbUnit.AddIn.dll
  27. BIN Tools/MbUnit/MbUnit.Cons.exe
  28. +0 −12 Tools/MbUnit/MbUnit.Cons.exe.config
  29. BIN Tools/MbUnit/MbUnit.Demo.1.1.dll
  30. +0 −20 Tools/MbUnit/MbUnit.Framework.1.1.XML
  31. BIN Tools/MbUnit/MbUnit.Framework.1.1.dll
  32. BIN Tools/MbUnit/MbUnit.Framework.2.0.dll
  33. +0 −10,995 Tools/MbUnit/MbUnit.Framework.XML
  34. BIN Tools/MbUnit/MbUnit.Framework.dll
  35. BIN Tools/MbUnit/MbUnit.GUI.exe
  36. +0 −14 Tools/MbUnit/MbUnit.GUI.exe.config
  37. BIN Tools/MbUnit/MbUnit.MSBuild.Tasks.dll
  38. BIN Tools/MbUnit/MbUnit.Tasks.dll
  39. BIN Tools/MbUnit/MbUnit.Tests.1.1.dll
  40. BIN Tools/MbUnit/NAnt.Core.dll
  41. +0 −14,462 Tools/MbUnit/NAnt.Core.xml
  42. BIN Tools/MbUnit/NGraphviz.Helpers.dll
  43. BIN Tools/MbUnit/NGraphviz.Layout.dll
  44. BIN Tools/MbUnit/NGraphviz.dll
  45. BIN Tools/MbUnit/QuickGraph.Algorithms.Graphviz.dll
  46. BIN Tools/MbUnit/QuickGraph.Algorithms.dll
  47. BIN Tools/MbUnit/QuickGraph.dll
  48. BIN Tools/MbUnit/Refly.dll
  49. BIN Tools/MbUnit/TestDriven.Framework.dll
  50. +0 −5,483 Tools/MbUnit/TestFu.XML
  51. BIN Tools/MbUnit/TestFu.dll
  52. BIN Tools/MbUnit/XsdTidy.exe
  53. BIN Tools/MbUnit/log4net.dll
  54. BIN Tools/MbUnit/uninst.exe
  55. +0 −6 Tools/MbUnit/users.txt
  56. BIN Tools/xUnit/XUnit.NAntTasks.dll
  57. BIN Tools/xUnit/xunit.console.exe
  58. +21 −0 Tools/xUnit/xunit.console.exe.config
  59. BIN Tools/xUnit/xunit.dll
  60. BIN Tools/xUnit/xunit.extensions.dll
  61. +705 −0 Tools/xUnit/xunit.extensions.xml
  62. BIN Tools/xUnit/xunit.gui.exe
  63. BIN Tools/xUnit/xunit.installer.exe
  64. BIN Tools/xUnit/xunit.runner.msbuild.dll
  65. BIN Tools/xUnit/xunit.runner.resharper.dll
  66. BIN Tools/xUnit/xunit.runner.tdnet.dll
  67. BIN Tools/xUnit/xunit.runner.utility.dll
  68. +407 −0 Tools/xUnit/xunit.runner.utility.xml
  69. +2,132 −0 Tools/xUnit/xunit.xml
  70. +2 −2 default.ps1
@@ -3,41 +3,38 @@ namespace Rhino.DSL.Tests
using System;
using System.Reflection;
using Boo.Lang.Compiler;
- using MbUnit.Framework;
+ using Xunit;
- [TestFixture]
public class AnonymousBaseClassTestFixture : BaseCompilerTestFixture
{
private Assembly assembly;
- [SetUp]
- public override void SetUp()
+ public AnonymousBaseClassTestFixture()
{
- base.SetUp();
assembly = Compile(@"AnonymousBaseClass.boo");
}
- [Test]
+ [Fact]
public void CanCreateAnonymousBaseClass()
{
- Assert.IsNotNull(this.assembly);
+ Assert.NotNull(this.assembly);
}
- [Test]
+ [Fact]
public void WillCreateTypeWithSameNameAsFile()
{
- Assert.IsNotNull(
+ Assert.NotNull(
assembly.GetType("AnonymousBaseClass")
);
}
- [Test]
+ [Fact]
public void CanExecuteNewTypeAndGetCodeFromFile()
{
MyAnonymousBaseClass instance = (MyAnonymousBaseClass)assembly.CreateInstance("AnonymousBaseClass");
instance.Run();
- Assert.AreEqual(
+ Assert.Equal(
"Hello from anonymous base class" + Environment.NewLine,
consoleOutput.GetStringBuilder().ToString());
}
@@ -2,12 +2,11 @@ namespace Rhino.DSL.Tests
{
using System.Xml;
using Boo.Lang.Compiler;
- using MbUnit.Framework;
+ using Xunit;
- [TestFixture]
public class AutoImportTextFixture : BaseCompilerTestFixture
{
- [Test]
+ [Fact]
public void Can_automatically_import_namespaces()
{
Compile("AutoImport.boo");
@@ -6,30 +6,29 @@ namespace Rhino.DSL.Tests
using Boo.Lang.Compiler;
using Boo.Lang.Compiler.IO;
using Boo.Lang.Compiler.Pipelines;
- using MbUnit.Framework;
+ using Xunit;
- [TestFixture]
public class AutoReferenceFilesCompilerStepFixure : BaseCompilerTestFixture
{
- [Test]
+ [Fact]
public void CanAddFileReference()
{
Assembly asm = Compile(@"hasReferenceToAnotherFile.boo", CompilerOutputType.ConsoleApplication);
asm.EntryPoint.Invoke(null, new object[1] { null });
- Assert.Contains(consoleOutput.GetStringBuilder().ToString(), "From second file");
+ Assert.Contains("From second file", consoleOutput.GetStringBuilder().ToString());
}
- [Test]
+ [Fact]
public void CanAddImportsFromAnotherFile()
{
Assembly asm = Compile(@"hasReferenceToAnotherFile.boo", CompilerOutputType.ConsoleApplication);
asm.EntryPoint.Invoke(null, new object[1] { null });
- Assert.Contains(consoleOutput.GetStringBuilder().ToString(), "Marshal");
+ Assert.Contains("Marshal", consoleOutput.GetStringBuilder().ToString());
}
@@ -7,16 +7,15 @@ namespace Rhino.DSL.Tests
using Boo.Lang.Compiler;
using Boo.Lang.Compiler.IO;
using Boo.Lang.Compiler.Pipelines;
- using MbUnit.Framework;
+ using Xunit;
- public class BaseCompilerTestFixture
+ public class BaseCompilerTestFixture : IDisposable
{
protected StringWriter consoleOutput;
private TextWriter oldConsole;
private string oldCurrentDir;
- [SetUp]
- public virtual void SetUp()
+ public BaseCompilerTestFixture()
{
oldCurrentDir = Environment.CurrentDirectory;
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
@@ -25,8 +24,7 @@ public virtual void SetUp()
Console.SetOut(consoleOutput);
}
- [TearDown]
- public void TearDown()
+ public void Dispose()
{
Environment.CurrentDirectory = oldCurrentDir;
Debug.WriteLine(consoleOutput.GetStringBuilder().ToString());
@@ -1,15 +1,14 @@
namespace Rhino.DSL.Tests
{
using System;
- using MbUnit.Framework;
+ using Xunit;
public class BaseDslFixture<TDslEngine, TDslBase>
where TDslEngine : DslEngine, new()
{
protected DslFactory factory;
- [SetUp]
- public void SetUp()
+ public BaseDslFixture()
{
factory = new DslFactory();
factory.BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
@@ -1,12 +1,11 @@
using Boo.Lang.Compiler.Ast;
-using MbUnit.Framework;
+using Xunit;
namespace Rhino.DSL.Tests
{
- [TestFixture]
public class BlockToArgumentsTransformerTestFixture
{
- [Test]
+ [Fact]
public void Expression_statement_is_transformed()
{
LiteralExpression exp = new StringLiteralExpression("arg1");
@@ -20,11 +19,11 @@ public void Expression_statement_is_transformed()
BlockToArgumentsTransformer transformer = new BlockToArgumentsTransformer("DoStuff");
transformer.Visit(fixture);
- Assert.AreEqual(exp, fixture.Arguments[0]);
- Assert.IsFalse(fixture.Block.HasStatements, "MacroStatement block should be empty after transformation.");
+ Assert.Equal(exp, fixture.Arguments[0]);
+ Assert.False(fixture.Block.HasStatements, "MacroStatement block should be empty after transformation.");
}
- [Test]
+ [Fact]
public void MacroStatement_with_no_arguments_and_no_block_is_transformed_to_ReferenceExpression()
{
const string referenceName = "some_reference";
@@ -38,10 +37,10 @@ public void MacroStatement_with_no_arguments_and_no_block_is_transformed_to_Refe
transformer.Visit(fixture);
Assert.IsAssignableFrom(typeof (ReferenceExpression), fixture.Arguments[0]);
- Assert.AreEqual(referenceName, (fixture.Arguments[0] as ReferenceExpression).Name);
+ Assert.Equal(referenceName, (fixture.Arguments[0] as ReferenceExpression).Name);
}
- [Test]
+ [Fact]
public void MacroStatement_with_block_is_transformed_to_MethodInvocationExpression()
{
const string methodInBlockName = "some_method";
@@ -59,12 +58,12 @@ public void MacroStatement_with_block_is_transformed_to_MethodInvocationExpressi
MethodInvocationExpression mie = doStuffStatement.Arguments[0] as MethodInvocationExpression;
- Assert.IsNotNull(mie, "Could not cast argument one of MacroStatement to MethodInvocationExpression.");
- Assert.AreEqual(methodInBlockName, (mie.Target as ReferenceExpression).Name);
+ Assert.NotNull(mie);
+ Assert.Equal(methodInBlockName, (mie.Target as ReferenceExpression).Name);
Assert.IsAssignableFrom(typeof (BlockExpression), mie.Arguments[0]);
}
- [Test]
+ [Fact]
public void MacroStatement_with_arguments_is_transformed_to_MethodInvocationExpression()
{
const string methodInBlockName = "some_method";
@@ -80,8 +79,8 @@ public void MacroStatement_with_arguments_is_transformed_to_MethodInvocationExpr
MethodInvocationExpression mie = fixture.Arguments[0] as MethodInvocationExpression;
- Assert.IsNotNull(mie, "Could not cast argument one of MacroStatement to MethodInvocationExpression.");
- Assert.AreEqual(methodInBlockName, (mie.Target as ReferenceExpression).Name);
+ Assert.NotNull(mie);//, "Could not cast argument one of MacroStatement to MethodInvocationExpression."
+ Assert.Equal(methodInBlockName, (mie.Target as ReferenceExpression).Name);
}
private MacroStatement GetMacroStatement(string name, params Statement[] blockStatements)
@@ -2,7 +2,7 @@ namespace Rhino.DSL.Tests
{
using System;
using System.IO;
- using MbUnit.Framework;
+ using Xunit;
public class ConsoleRecorder : IDisposable
{
@@ -23,7 +23,7 @@ public string Result
public void AssertEquals(string expected)
{
- Assert.AreEqual(expected, Result);
+ Assert.Equal(expected, Result);
}
public void Dispose()
@@ -4,57 +4,54 @@ namespace Rhino.DSL.Tests.DslFactoryFixture
using System.IO;
using System.Reflection;
using Boo.Lang.Compiler;
- using MbUnit.Framework;
+ using Xunit;
using Boo.Lang.Compiler.Ast;
- [TestFixture]
- public class DslEngineFixture
+ public class DslEngineFixture : IDisposable
{
private MyDslEngine engine;
- [SetUp]
- public void SetUp()
+ public DslEngineFixture()
{
engine = new MyDslEngine();
}
- [TearDown]
- public void TearDown()
+ public void Dispose()
{
foreach (string file in Directory.GetFiles(Path.GetTempPath(), "*.boocache"))
{
File.Delete(file);
}
}
- [Test]
+ [Fact]
public void When_DSL_engine_is_asked_to_create_a_DSL_it_will_compile_and_return_the_compiler_context()
{
string path = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"DslFactoryFixture\MyDsl.boo"));
CompilerContext compilerContext = engine.Compile(path);
- Assert.AreEqual(0, compilerContext.Errors.Count);
- Assert.IsNotNull(compilerContext.GeneratedAssembly);
+ Assert.Equal(0, compilerContext.Errors.Count);
+ Assert.NotNull(compilerContext.GeneratedAssembly);
}
- [Test]
- [ExpectedException(typeof(CompilerError))]
+ [Fact]
public void When_compilation_result_in_an_error_should_throw()
{
- engine.Compile(Path.GetFullPath(@"somethingThatDoesNotExists.boo"));
+ Assert.Throws<CompilerError>(() =>
+ engine.Compile(Path.GetFullPath(@"somethingThatDoesNotExists.boo")));
}
- [Test]
+ [Fact]
public void Dsl_engine_can_take_parameters()
{
DslFactory _Factory = new DslFactory();
_Factory.BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
_Factory.Register<MyClassWithParams>(new DslEngineWithParameters());
MyClassWithParams classWithParams = _Factory.Create<MyClassWithParams>("DslFactoryFixture\\ScriptWithParameter.boo");
- Assert.AreEqual("World", classWithParams.Hello("World"));
+ Assert.Equal("World", classWithParams.Hello("World"));
}
- [Test]
+ [Fact]
public void engine_reuses_first_compile()
{
string scriptPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"DslFactoryFixture\engine_reuses_first_compile.boo"));
@@ -65,16 +62,16 @@ public void engine_reuses_first_compile()
engine.CompilerContextCache.AssemblyLoaded += delegate (string filename, Assembly assembly, bool fromCache)
{ lastCachedFilePath = filename; };
engine.Compile(scriptPath);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
lastCachedFilePath = null;
engine.Compile(scriptPath);
- Assert.IsTrue(lastCachedFilePath == null);
+ Assert.True(lastCachedFilePath == null);
}
- [Test]
+ [Fact]
public void engine_recompiles_on_script_change()
{
string scriptPath = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"DslFactoryFixture\engine_recompiles_on_script_change.boo"));
@@ -85,14 +82,14 @@ public void engine_recompiles_on_script_change()
File.WriteAllText(scriptPath, "print 1");
engine.Compile(scriptPath);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
lastCachedFilePath = null;
File.WriteAllText(scriptPath, "print 2");
engine.Compile(scriptPath);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
}
- [Test]
+ [Fact]
public void engine_recompiles_on_script_add()
{
string scriptPath1 = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"DslFactoryFixture\engine_recompiles_on_script_add1.boo"));
@@ -107,13 +104,13 @@ public void engine_recompiles_on_script_add()
{ lastCachedFilePath = filename; };
engine.Compile(scriptPath1);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
lastCachedFilePath = null;
engine.Compile(scriptPath1, scriptPath2);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
}
- [Test]
+ [Fact]
public void engine_recompiles_on_script_remove()
{
string scriptPath1 = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"DslFactoryFixture\engine_recompiles_on_script_remove1.boo"));
@@ -128,11 +125,11 @@ public void engine_recompiles_on_script_remove()
{ lastCachedFilePath = filename; };
engine.Compile(scriptPath1, scriptPath2);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
lastCachedFilePath = null;
engine.Compile(scriptPath1);
- Assert.IsFalse(lastCachedFilePath == null);
+ Assert.False(lastCachedFilePath == null);
}
}
Oops, something went wrong.

0 comments on commit d446ed8

Please sign in to comment.