You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by do...@apache.org on 2015/12/04 17:15:03 UTC
[2/2] reef git commit: [REEF-1030] Migrate Tang tests which use only
simple attributes to xUnit
[REEF-1030] Migrate Tang tests which use only simple attributes to xUnit
This migrates first batch of Tang tests to xUnit.
JIRA:
[REEF-1030](https://issues.apache.org/jira/browse/REEF-1030)
Pull request:
This closes #692
Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/9c36dba5
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/9c36dba5
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/9c36dba5
Branch: refs/heads/master
Commit: 9c36dba5504ef5a56fccf763a976cefdab43e6e6
Parents: 13e4572
Author: Mariia Mykhailova <ma...@apache.org>
Authored: Tue Dec 1 15:58:21 2015 -0800
Committer: Dongjoon Hyun <do...@apache.org>
Committed: Sat Dec 5 00:25:39 2015 +0900
----------------------------------------------------------------------
.../ClassHierarchy/TestAvroSerialization.cs | 85 ++++-------
.../ClassHierarchy/TestClassHierarchy.cs | 153 +++++++++----------
.../ClassHierarchy/TestGeneric.cs | 8 +-
.../ClassHierarchy/TestMultipleInterface.cs | 5 +-
.../ClassHierarchy/TestNamedParameter.cs | 33 ++--
.../ClassHierarchy/TestParameterParser.cs | 61 ++++----
.../Configuration/TestAvroConfiguration.cs | 9 +-
.../Configuration/TestConfiguration.cs | 86 +++++------
.../TestCsConfigurationBuilderExtension.cs | 53 ++++---
.../Format/TestConfigurationModule.cs | 117 ++++++--------
.../Format/TestConfigurationModuleForList.cs | 27 ++--
.../Format/TestTaskConfiguration.cs | 21 ++-
.../Injection/TestAmbigousConstructors.cs | 7 +-
.../Injection/TestInjectionFuture.cs | 55 ++++---
.../Injection/TestListInjection.cs | 133 ++++++++--------
.../Injection/TestMissingParameters.cs | 23 ++-
.../Injection/TestMissingParamtersInNested.cs | 23 ++-
.../Injection/TestMultipleConstructors.cs | 53 ++++---
.../Injection/TestNamedParameter.cs | 45 +++---
.../Injection/TestSetInjection.cs | 105 +++++++------
.../ScenarioTest/TestDefaultConstructor.cs | 5 +-
.../ScenarioTest/TestHttpService.cs | 39 +++--
.../ScenarioTest/TestRuntimeClock.cs | 13 +-
.../ScenarioTest/TestTrackingURIProvider.cs | 15 +-
.../SmokeTest/ObjectTreeTest.cs | 13 +-
.../Tang/TestDefaultImpementaion.cs | 39 +++--
.../Tang/TestExternalConstructors.cs | 18 +--
.../Tang/TestLegacyConstructors.cs | 12 +-
.../Utilities/AssemblyLoaderTests.cs | 11 +-
.../Utilities/TestUtilities.cs | 75 +++++----
30 files changed, 627 insertions(+), 715 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
index ea6a112..ee0dd07 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestAvroSerialization.cs
@@ -20,7 +20,6 @@
using System;
using System.IO;
using Microsoft.Hadoop.Avro;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Examples;
using Org.Apache.REEF.Tang.Implementations.ClassHierarchy;
@@ -28,40 +27,20 @@ using Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Types;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestAvroSerialization
{
private AvroClassHierarchySerializer _serializer =
(AvroClassHierarchySerializer)TangFactory.GetTang().NewInjector().GetInstance<IClassHierarchySerializer>();
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- }
-
- [ClassCleanup]
- public static void ClassCleanup()
- {
- }
-
- [TestInitialize]
- public void TestSetup()
- {
- }
-
- [TestCleanup]
- public void TestCleanup()
- {
- }
-
/// <summary>
/// This test is to convert an ClassHierarchy into AvroNode object, and then convert it back to an
/// AvroClassHierarchy.
/// </summary>
- [TestMethod]
+ [Fact]
public void TestToFromAvroNode()
{
Type timerType = typeof(Timer);
@@ -81,9 +60,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
@@ -92,18 +71,18 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
/// I have manually synced all the IList into List in auto generated code. Otherwise AvroSerializer.Create<AvroNode>() will throw the following error
/// "Could not find any matching known type for 'System.Collections.Generic.IList`1[Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract.AvroConstructorDef]'."
/// </summary>
- [TestMethod]
+ [Fact]
public void TestGetSchema()
{
var serializer = AvroSerializer.Create<AvroNode>();
var s = serializer.WriterSchema.ToString();
- Assert.IsNotNull(s);
+ Assert.NotNull(s);
}
/// <summary>
/// This test is to merge two AvroClassHierarchies
/// </summary>
- [TestMethod]
+ [Fact]
public void TestAvroClassHierarchyMerge()
{
IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(
@@ -125,30 +104,30 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
IClassNode timerClassNode2 = (IClassNode)ns5.GetNode(typeof(Timer).AssemblyQualifiedName);
IClassNode avroNodeClassNode2 = (IClassNode)ns5.GetNode(typeof(AvroNode).AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(avroNodeClassNode, avroNodeClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(avroNodeClassNode, avroNodeClassNode2);
}
/// <summary>
/// Test serialize a class hierarchy into a test file
/// </summary>
- [TestMethod]
+ [Fact]
public void TestToTextFileForTask()
{
IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(HelloTask).Assembly.GetName().Name });
_serializer.ToTextFile(ns, "avroTask.bin");
- Assert.IsTrue(File.Exists("avroTask.bin"));
+ Assert.True(File.Exists("avroTask.bin"));
}
/// <summary>
/// Test serialize a class hierarchy into a JSon string
/// </summary>
- [TestMethod]
+ [Fact]
public void TestToString()
{
IClassHierarchy ns = TangFactory.GetTang().GetClassHierarchy(new string[] { typeof(HelloTask).Assembly.GetName().Name });
string s = _serializer.ToString(ns);
- Assert.IsNotNull(s);
+ Assert.NotNull(s);
}
/// <summary>
@@ -157,8 +136,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
/// Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract.AvroClassNode'.
/// This is because auto generated code use object as return type instead of AvroClassNode
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromJsonString()
{
Type timerType = typeof(Timer);
@@ -178,9 +156,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
@@ -189,8 +167,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
/// Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Org.Apache.REEF.Tang.Implementations.ClassHierarchy.AvroDataContract.AvroClassNode'.
/// This is because auto generated code use object as return type instead of AvroClassNode
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromTextFile()
{
Type timerType = typeof(Timer);
@@ -210,17 +187,16 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
/// Test serialize a class hierarchy to a file and deserialize from the file
/// Currently, in ToFile() method, writer.Write(avroNodeData) throw exception "Value cannot be null.\r\nParameter name: value".
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromFile()
{
Type timerType = typeof(Timer);
@@ -240,17 +216,16 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
/// <summary>
/// Test serialize class hierarchy to byte array and deserializa back to class hierarchy
/// AvroSerializer.Serialize(stream, obj) doesn't allow any null values in the obj to be serialized even if it is nullable
/// </summary>
- [Ignore] // TODO: after Avro fix the issue. Enable the test
- [TestMethod]
+ [Fact(Skip = "TODO: after Avro fix the issue, enable the test")]
public void TestToFromByteArray()
{
Type timerType = typeof(Timer);
@@ -270,9 +245,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
INode secondNode2 = ns2.GetNode(secondType.AssemblyQualifiedName);
IClassNode simpleConstructorsClassNode2 = (IClassNode)ns2.GetNode(simpleConstructorType.AssemblyQualifiedName);
- Assert.AreEqual(timerClassNode, timerClassNode2);
- Assert.AreEqual(secondNode, secondNode2);
- Assert.AreEqual(simpleConstructorsClassNode, simpleConstructorsClassNode2);
+ Assert.Equal(timerClassNode, timerClassNode2);
+ Assert.Equal(secondNode, secondNode2);
+ Assert.Equal(simpleConstructorsClassNode, simpleConstructorsClassNode2);
}
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
index 788d756..fa64ff1 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs
@@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Annotations;
@@ -29,16 +28,15 @@ using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Types;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestClassHierarchy
{
public IClassHierarchy ns = null;
- [TestInitialize]
- public void TestSetup()
+ public TestClassHierarchy()
{
if (ns == null)
{
@@ -47,12 +45,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
}
}
- [TestCleanup]
- public void TestCleanup()
- {
- }
-
- [TestMethod]
+ [Fact]
public void TestString()
{
INode n = null;
@@ -66,9 +59,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (NameResolutionException)
{
}
- Assert.IsNull(n);
+ Assert.Null(n);
- Assert.IsNotNull(ns.GetNode(typeof(System.String).AssemblyQualifiedName));
+ Assert.NotNull(ns.GetNode(typeof(System.String).AssemblyQualifiedName));
string msg = null;
try
@@ -83,10 +76,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestInt()
{
INode n = null;
@@ -100,9 +93,9 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (NameResolutionException)
{
}
- Assert.IsNull(n);
+ Assert.Null(n);
- Assert.IsNotNull(ns.GetNode(typeof(System.Int32).AssemblyQualifiedName));
+ Assert.NotNull(ns.GetNode(typeof(System.Int32).AssemblyQualifiedName));
string msg = null;
try
@@ -117,159 +110,159 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestSimpleConstructors()
{
IClassNode cls = (IClassNode)ns.GetNode(typeof(SimpleConstructors).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetChildren().Count == 0);
+ Assert.True(cls.GetChildren().Count == 0);
IList<IConstructorDef> def = cls.GetInjectableConstructors();
- Assert.AreEqual(3, def.Count);
+ Assert.Equal(3, def.Count);
}
- [TestMethod]
+ [Fact]
public void TestTimer()
{
IClassNode timerClassNode = (IClassNode)ns.GetNode(typeof(Timer).AssemblyQualifiedName);
INode secondNode = ns.GetNode(typeof(Timer.Seconds).AssemblyQualifiedName);
- Assert.AreEqual(secondNode.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Timer.Seconds)));
+ Assert.Equal(secondNode.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(Timer.Seconds)));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterConstructors()
{
var node = ns.GetNode(typeof(NamedParameterConstructors).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(NamedParameterConstructors)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(NamedParameterConstructors)));
}
- [TestMethod]
+ [Fact]
public void TestArray()
{
Type t = (new string[0]).GetType();
INode node = ns.GetNode(t.AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), t.AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), t.AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestRepeatConstructorArg()
{
TestNegativeCase(typeof(RepeatConstructorArg),
"Repeated constructor parameter detected. Cannot inject constructor RepeatConstructorArg(int,int).");
}
- [TestMethod]
+ [Fact]
public void TestRepeatConstructorArgClasses()
{
TestNegativeCase(typeof(RepeatConstructorArgClasses),
"Repeated constructor parameter detected. Cannot inject constructor RepeatConstructorArgClasses(A, A).");
}
- [TestMethod]
+ [Fact]
public void testLeafRepeatedConstructorArgClasses()
{
INode node = ns.GetNode(typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(LeafRepeatedConstructorArgClasses).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestNamedRepeatConstructorArgClasses()
{
INode node = ns.GetNode(typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(NamedRepeatConstructorArgClasses).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestResolveDependencies()
{
ns.GetNode(typeof(SimpleConstructors).AssemblyQualifiedName);
- Assert.IsNotNull(ns.GetNode(typeof(string).AssemblyQualifiedName));
+ Assert.NotNull(ns.GetNode(typeof(string).AssemblyQualifiedName));
}
- [TestMethod]
+ [Fact]
public void TestDocumentedLocalNamedParameter()
{
var node = ns.GetNode(typeof(DocumentedLocalNamedParameter).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(DocumentedLocalNamedParameter)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(DocumentedLocalNamedParameter)));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterTypeMismatch()
{
TestNegativeCase(typeof(NamedParameterTypeMismatch),
"Named parameter type mismatch in NamedParameterTypeMismatch. Constructor expects a System.String but Foo is a System.Int32.");
}
- [TestMethod]
+ [Fact]
public void TestUnannotatedName()
{
TestNegativeCase(typeof(UnannotatedName),
"Named parameter UnannotatedName is missing its [NamedParameter] attribute.");
}
- [TestMethod]
+ [Fact]
public void TestAnnotatedNotName()
{
TestNegativeCase(typeof(AnnotatedNotName),
"Found illegal [NamedParameter] AnnotatedNotName does not implement Name<T>.");
}
- [TestMethod]
+ [Fact]
public void TestAnnotatedNameWrongInterface()
{
TestNegativeCase(typeof(AnnotatedNameWrongInterface),
"Found illegal [NamedParameter] AnnotatedNameWrongInterface does not implement Name<T>.");
}
- [TestMethod]
+ [Fact]
public void TestAnnotatedNameMultipleInterfaces()
{
TestNegativeCase(typeof(AnnotatedNameMultipleInterfaces),
"Named parameter Org.Apache.REEF.Tang.Implementation.AnnotatedNameMultipleInterfaces implements multiple interfaces. It is only allowed to implement Name<T>.");
}
- [TestMethod]
+ [Fact]
public void TestUnAnnotatedNameMultipleInterfaces()
{
TestNegativeCase(typeof(UnAnnotatedNameMultipleInterfaces),
"Named parameter Org.Apache.REEF.Tang.Implementation.UnAnnotatedNameMultipleInterfaces is missing its @NamedParameter annotation.");
}
- [TestMethod]
+ [Fact]
public void TestNameWithConstructor()
{
TestNegativeCase(typeof(NameWithConstructor),
"Named parameter Org.Apache.REEF.Tang.Implementation.NameWithConstructor has a constructor. Named parameters must not declare any constructors.");
}
- [TestMethod]
+ [Fact]
public void TestNameWithZeroArgInject()
{
TestNegativeCase(typeof(NameWithZeroArgInject),
"Named parameter Org.Apache.REEF.Tang.Implementation.NameWithZeroArgInject has an injectable constructor. Named parameters must not declare any constructors.");
}
- [TestMethod]
+ [Fact]
public void TestInjectNonStaticLocalArgClass()
{
var node = ns.GetNode(typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(InjectNonStaticLocalArgClass).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestInjectNonStaticLocalType()
{
var node = ns.GetNode(typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(InjectNonStaticLocalType).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestOKShortNames()
{
var node = ns.GetNode(typeof(ShortNameFooA).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(ShortNameFooA).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(ShortNameFooA).AssemblyQualifiedName);
}
public void TestConflictingShortNames()
@@ -287,30 +280,30 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
Console.WriteLine(e);
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestRoundTripInnerClassNames()
{
INode node = ns.GetNode(typeof(Nested.Inner).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(Nested.Inner).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(Nested.Inner).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestRoundTripAnonInnerClassNames()
{
INode node1 = ns.GetNode(typeof(AnonNested.X1).AssemblyQualifiedName);
INode node2 = ns.GetNode(typeof(AnonNested.Y1).AssemblyQualifiedName);
- Assert.AreNotEqual(node1.GetFullName(), node2.GetFullName());
+ Assert.NotEqual(node1.GetFullName(), node2.GetFullName());
Type t1 = ReflectionUtilities.GetTypeByName(node1.GetFullName());
Type t2 = ReflectionUtilities.GetTypeByName(node2.GetFullName());
- Assert.AreNotSame(t1, t2);
+ Assert.NotSame(t1, t2);
}
- [TestMethod]
+ [Fact]
public void TestNameCantBindWrongSubclassAsDefault()
{
TestNegativeCase(typeof(BadName),
@@ -318,22 +311,22 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
}
- [TestMethod]
+ [Fact]
public void TestNameCantBindWrongSubclassOfArgumentAsDefault()
{
TestNegativeCase(typeof(BadNameForGeneric),
"class BadNameForGeneric defines a default class Int32 with a type that does not extend of its target's string in ISet<string>");
}
- [TestMethod]
+ [Fact]
public void TestNameCantBindSubclassOfArgumentAsDefault()
{
ns = TangFactory.GetTang().GetClassHierarchy(new string[] { FileNames.Examples, FileNames.Common, FileNames.Tasks });
INode node = ns.GetNode(typeof(GoodNameForGeneric).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), typeof(GoodNameForGeneric).AssemblyQualifiedName);
+ Assert.Equal(node.GetFullName(), typeof(GoodNameForGeneric).AssemblyQualifiedName);
}
- [TestMethod]
+ [Fact]
public void TestInterfaceCantBindWrongImplAsDefault()
{
TestNegativeCase(typeof(IBadIfaceDefault),
@@ -351,32 +344,32 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (Exception)
{
}
- Assert.IsNull(msg, msg);
+ Assert.True(msg == null, msg);
}
- [TestMethod]
+ [Fact]
public void TestParseableDefaultClassNotOK()
{
TestNegativeCase(typeof(BadParsableDefaultClass),
"Named parameter BadParsableDefaultClass defines default implementation for parsable type System.string");
}
- [TestMethod]
+ [Fact]
public void testGenericTorture1()
{
g(typeof(GenericTorture1));
}
- [TestMethod]
+ [Fact]
public void testGenericTorture2()
{
g(typeof(GenericTorture2));
}
- [TestMethod]
+ [Fact]
public void testGenericTorture3()
{
g(typeof(GenericTorture3));
}
- [TestMethod]
+ [Fact]
public void testGenericTorture4()
{
g(typeof(GenericTorture4));
@@ -389,31 +382,31 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
public INode g(Type t)
{
INode n = ns.GetNode(s(t));
- Assert.IsNotNull(n);
+ Assert.NotNull(n);
return n;
}
- [TestMethod]
+ [Fact]
public void TestHelloTaskNode()
{
var node = ns.GetNode(typeof(HelloTask).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(HelloTask)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(HelloTask)));
}
- [TestMethod]
+ [Fact]
public void TestITackNode()
{
var node = ns.GetNode(typeof(ITask).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(ITask)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(ITask)));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterIdentifier()
{
var node = ns.GetNode(typeof(TaskConfigurationOptions.Identifier).AssemblyQualifiedName);
- Assert.AreEqual(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(TaskConfigurationOptions.Identifier)));
+ Assert.Equal(node.GetFullName(), ReflectionUtilities.GetAssemblyQualifiedName(typeof(TaskConfigurationOptions.Identifier)));
}
- [TestMethod]
+ [Fact]
public void TestInterface()
{
g(typeof(A));
@@ -435,11 +428,11 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
var b = (B)i.GetInstance(typeof(B));
var c = (C)i.GetInstance(typeof(C));
- Assert.IsNotNull(a);
- Assert.IsNotNull(implString);
- Assert.IsNotNull(implInt);
- Assert.IsNotNull(b);
- Assert.IsNotNull(c);
+ Assert.NotNull(a);
+ Assert.NotNull(implString);
+ Assert.NotNull(implInt);
+ Assert.NotNull(b);
+ Assert.NotNull(c);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
index 0e53847..6e01c1c 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestGeneric.cs
@@ -18,23 +18,21 @@
*/
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Examples;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Wake.RX;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestGeneric
{
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
+ public TestGeneric()
{
TangImpl.Reset();
}
- [TestMethod]
+ [Fact]
public void TestGenericClassWithT()
{
List<string> appDlls = new List<string>();
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
index a92e366..19a4002 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestMultipleInterface.cs
@@ -18,16 +18,15 @@
*/
using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations.Tang;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestMultipleInterface
{
- [TestMethod]
+ [Fact]
public void TestFoo()
{
var ch = TangFactory.GetTang().GetDefaultClassHierarchy();
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
index cf7bdd4..c40ae5e 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestNamedParameter.cs
@@ -17,40 +17,39 @@
* under the License.
*/
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Formats;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Protobuf;
using Org.Apache.REEF.Tang.Types;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestNamedParameter
{
- [TestMethod]
+ [Fact]
public void TestNamedParameterWithDefaultValues()
{
var ns = TangFactory.GetTang().GetDefaultClassHierarchy();
INamedParameterNode cls = (INamedParameterNode)ns.GetNode(typeof(NamedParameterWithDefaultValues).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetDocumentation().Equals("NamedParameterWithDefaultValues"));
- Assert.IsTrue(cls.GetShortName().Equals("NamedParameterWithDefaultValues"));
- Assert.IsTrue(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithDefaultValues"));
- Assert.IsTrue(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
+ Assert.True(cls.GetDocumentation().Equals("NamedParameterWithDefaultValues"));
+ Assert.True(cls.GetShortName().Equals("NamedParameterWithDefaultValues"));
+ Assert.True(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithDefaultValues"));
+ Assert.True(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterWithAlias()
{
var ns = TangFactory.GetTang().GetDefaultClassHierarchy();
INamedParameterNode cls = (INamedParameterNode)ns.GetNode(typeof(NamedParameterWithAlias).AssemblyQualifiedName);
- Assert.IsTrue(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
- Assert.IsTrue(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
+ Assert.True(cls.GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
+ Assert.True(cls.GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
}
- [TestMethod]
+ [Fact]
public void TestNamedParameterWithAliasRoundTrip()
{
var ns = TangFactory.GetTang().GetDefaultClassHierarchy();
@@ -59,13 +58,13 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
var ns1 = new ProtocolBufferClassHierarchy(ProtocolBufferClassHierarchy.Serialize(ns));
var node2 = ns1.GetNode(typeof(NamedParameterWithAlias).AssemblyQualifiedName);
- Assert.IsTrue(node2 is INamedParameterNode);
- Assert.IsTrue(((INamedParameterNode)node2).GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
- Assert.IsTrue(((INamedParameterNode)node2).GetFullName().Equals(typeof(NamedParameterWithAlias).AssemblyQualifiedName));
- Assert.IsTrue(((INamedParameterNode)node2).GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
+ Assert.True(node2 is INamedParameterNode);
+ Assert.True(((INamedParameterNode)node2).GetAliasLanguage().ToString().Equals(Language.Java.ToString()));
+ Assert.True(((INamedParameterNode)node2).GetFullName().Equals(typeof(NamedParameterWithAlias).AssemblyQualifiedName));
+ Assert.True(((INamedParameterNode)node2).GetAlias().Equals("org.apache.REEF.tang.tests.classHierarchy.NamedParameterWithAlias"));
}
- [TestMethod]
+ [Fact]
public void TestGetNamedparameterValue()
{
var b = TangFactory.GetTang().NewConfigurationBuilder()
@@ -76,7 +75,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
var i = TangFactory.GetTang().NewInjector(b);
var o = i.GetInstance<ClassWithNamedParameterWithAlias>();
var no = i.GetNamedInstance<NamedParameterWithAlias, string>();
- Assert.IsTrue(o.Value.Equals("test"));
+ Assert.True(o.Value.Equals("test"));
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
index 3d107be..1ab5384 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs
@@ -18,19 +18,18 @@
*/
using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations.ClassHierarchy;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
{
- [TestClass]
public class TestParameterParser
{
- [TestMethod]
+ [Fact]
public void ParseIntTest()
{
var parser = new ParameterParser();
@@ -38,79 +37,79 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
}
- [TestMethod]
+ [Fact]
public void ParseBoolTest()
{
var parser = new ParameterParser();
Boolean o = (Boolean)parser.Parse(typeof(Boolean), "false");
}
- [TestMethod]
+ [Fact]
public void ParseLongTest()
{
var parser = new ParameterParser();
long o = (long)parser.Parse(typeof(long), "8675309");
}
- [TestMethod]
+ [Fact]
public void ParseStringTest()
{
var parser = new ParameterParser();
string o = (string)parser.Parse(typeof(string), "hello");
}
- [TestMethod]
+ [Fact]
public void ParseDoubleTest()
{
var parser = new ParameterParser();
Double o = (Double)parser.Parse(typeof(double), "12.6");
}
- [TestMethod]
+ [Fact]
public void ParseCharTest()
{
var parser = new ParameterParser();
Char o = (Char)parser.Parse(typeof(char), "c");
}
- [TestMethod]
+ [Fact]
public void ParseByteTest()
{
var parser = new ParameterParser();
Byte o = (Byte)parser.Parse(typeof(byte), "8");
}
- [TestMethod]
+ [Fact]
public void ParseShortTest()
{
var parser = new ParameterParser();
Int16 o = (Int16)parser.Parse(typeof(short), "8");
}
- [TestMethod]
+ [Fact]
public void ParseFloatTest()
{
var parser = new ParameterParser();
Single o = (Single)parser.Parse(typeof(float), "8.567");
}
- [TestMethod]
+ [Fact]
public void ParseByteArrayTest()
{
var parser = new ParameterParser();
byte[] o = (byte[])parser.Parse(typeof(byte[]), "hello");
}
- [TestMethod]
+ [Fact]
public void ParameterParserTest()
{
ParameterParser p = new ParameterParser();
p.AddParser(typeof(FooParser));
Foo f = (Foo)p.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestUnregisteredParameterParser()
{
ParameterParser p = new ParameterParser();
@@ -124,19 +123,19 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (NotSupportedException)
{
}
- Assert.IsNull(f);
+ Assert.Null(f);
}
- [TestMethod]
+ [Fact]
public void TestReturnSubclass()
{
ParameterParser p = new ParameterParser();
p.AddParser(typeof(BarParser));
Bar f = (Bar)p.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestGoodMerge()
{
ParameterParser old = new ParameterParser();
@@ -144,10 +143,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
ParameterParser nw = new ParameterParser();
nw.MergeIn(old);
Bar f = (Bar)nw.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestGoodMerge2()
{
ParameterParser old = new ParameterParser();
@@ -156,10 +155,10 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
nw.AddParser(typeof(BarParser));
nw.MergeIn(old);
Bar f = (Bar)nw.Parse(typeof(Foo), "woot");
- Assert.AreEqual(f.s, "woot");
+ Assert.Equal(f.s, "woot");
}
- [TestMethod]
+ [Fact]
public void TestBadMerge()
{
string msg = null;
@@ -175,20 +174,20 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
catch (ArgumentException)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void testEndToEnd()
{
ITang tang = TangFactory.GetTang();
ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new Type[] { typeof(BarParser) });
cb.BindNamedParameter<SomeNamedFoo, Foo>(GenericType<SomeNamedFoo>.Class, "hdfs://woot");
ILikeBars ilb = tang.NewInjector(cb.Build()).GetInstance<ILikeBars>();
- Assert.IsNotNull(ilb);
+ Assert.NotNull(ilb);
}
- [TestMethod]
+ [Fact]
public void TestDelegatingParser()
{
ITang tang = TangFactory.GetTang();
@@ -199,7 +198,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
cb2.BindNamedParameter<ParseName, ParseableType>(GenericType<ParseName>.Class, "a"); // ParseName : Name<ParseableType>
ParseableType t = (ParseableType)tang.NewInjector(cb2.Build()).GetNamedInstance(typeof(ParseName));
- Assert.IsTrue(t is ParseTypeA);
+ Assert.True(t is ParseTypeA);
cb2 = tang.NewConfigurationBuilder(cb.Build());
cb2.BindNamedParameter<ParseNameB, ParseTypeB>(GenericType<ParseNameB>.Class, "b"); // ParseNameB : Name<ParseTypeB : ParseableType>
@@ -257,7 +256,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
ILikeBars([Parameter(typeof(SomeNamedFoo))] Foo bar)
{
Bar b = (Bar)bar;
- Assert.AreEqual(b.s, "hdfs://woot");
+ Assert.Equal(b.s, "hdfs://woot");
}
}
@@ -309,7 +308,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
[Inject]
public NeedsA([Parameter(typeof(ParseNameA))] ParseableType a)
{
- Assert.IsTrue(a is ParseTypeA);
+ Assert.True(a is ParseTypeA);
}
}
@@ -318,7 +317,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy
[Inject]
public NeedsB([Parameter(typeof(ParseNameB))] ParseTypeB b)
{
- Assert.IsTrue(b is ParseTypeB);
+ Assert.True(b is ParseTypeB);
}
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
index 3dda5d0..f5b03db 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestAvroConfiguration.cs
@@ -18,7 +18,6 @@
*/
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Formats;
@@ -27,13 +26,13 @@ using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Types;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Configuration
{
- [TestClass]
public class TestAvroConfiguration
{
- [TestMethod]
+ [Fact]
public void TestFromJsonString()
{
IConfigurationSerializer serializerImpl = (IConfigurationSerializer)TangFactory.GetTang().NewInjector().GetInstance(typeof(IConfigurationSerializer));
@@ -44,12 +43,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
string jsonStr = serializerImpl.ToString(conf);
IConfiguration c = serializerImpl.FromString(jsonStr);
- Assert.IsNotNull(c);
+ Assert.NotNull(c);
string jsonStr2 = serializerImpl.ToString(c);
IConfiguration c1 = serializerImpl.FromString(jsonStr2);
- Assert.IsNotNull(c1);
+ Assert.NotNull(c1);
}
private AvroConfiguration ToAvroConfiguration()
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
index f986316..d6093e6 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs
@@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Annotations;
@@ -34,18 +33,13 @@ using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Protobuf;
using Org.Apache.REEF.Tang.Tests.ScenarioTest;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Configuration
{
- [TestClass]
public class TestConfiguration
{
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- }
-
- [TestMethod]
+ [Fact]
public void TestDeserializedConfigMerge()
{
Type activityInterfaceType = typeof(ITask);
@@ -78,7 +72,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
var b = merged.newBuilder().Build();
}
- [TestMethod]
+ [Fact]
public void TestActivityConfiguration()
{
Type activityInterfaceType = typeof(ITask);
@@ -99,10 +93,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang1.NewInjector(conf1);
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestMultipleConfiguration()
{
Type activityInterfaceType = typeof(ITask);
@@ -120,14 +114,14 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = TangFactory.GetTang().NewInjector(new IConfiguration[] { conf, httpConfiguraiton });
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
RuntimeClock clock = injector.GetInstance<RuntimeClock>();
var rh = clock.ClockRuntimeStartHandler.Get();
- Assert.AreEqual(rh.Count, 1);
+ Assert.Equal(rh.Count, 1);
}
- [TestMethod]
+ [Fact]
public void TestActivityConfigWithSeparateAssembly()
{
Type activityInterfaceType = typeof(ITask);
@@ -147,10 +141,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
.NewInjector(new string[] { FileNames.Common, FileNames.Tasks }, "TaskConf1.txt")
.GetInstance(typeof(ITask));
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestGetConfigFromProtoBufClassHierarchy()
{
Type iTaskType = typeof(ITask);
@@ -168,7 +162,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
ConfigurationFile.WriteConfigurationFile(conf, "taskConf2.txt");
}
- [TestMethod]
+ [Fact]
public void TestActivityConfig()
{
Type activityInterfaceType = typeof(ITask);
@@ -182,10 +176,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang.NewInjector(new string[] { FileNames.Common, FileNames.Tasks }, "TaskConf.txt");
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestActivityConfigWithString()
{
Type activityInterfaceType = typeof(ITask);
@@ -202,10 +196,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang.NewInjector(conf2);
var activityRef = (ITask)injector.GetInstance(activityInterfaceType);
- Assert.IsNotNull(activityRef);
+ Assert.NotNull(activityRef);
}
- [TestMethod]
+ [Fact]
public void TestTweetConfiguration()
{
Type tweeterType = typeof(Tweeter);
@@ -228,7 +222,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfig()
{
Type tweeterType = typeof(Tweeter);
@@ -248,7 +242,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigWithAvroThroughFile()
{
Type tweeterType = typeof(Tweeter);
@@ -270,7 +264,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigAddConfigurationFromString()
{
Type tweeterType = typeof(Tweeter);
@@ -294,7 +288,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigWithAvroSerialization()
{
Type tweeterType = typeof(Tweeter);
@@ -316,7 +310,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetConfigGetConfigurationFromString()
{
Type tweeterType = typeof(Tweeter);
@@ -338,7 +332,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
tweeter.sendMessage();
}
- [TestMethod]
+ [Fact]
public void TestTweetInvalidBinding()
{
string msg = null;
@@ -352,10 +346,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
{
msg = e.Message;
}
- Assert.IsNotNull(msg);
+ Assert.NotNull(msg);
}
- [TestMethod]
+ [Fact]
public void TestTimerConfiguration()
{
Type timerType = typeof(Timer);
@@ -375,12 +369,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang.NewInjector(conf1);
var timer = (Timer)injector.GetInstance(timerType);
- Assert.IsNotNull(timer);
+ Assert.NotNull(timer);
timer.sleep();
}
- [TestMethod]
+ [Fact]
public void TestDocumentLoadNamedParameterConfiguration()
{
Type documentedLocalNamedParameterType = typeof(DocumentedLocalNamedParameter);
@@ -401,11 +395,11 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang1.NewInjector(conf1);
var doc = (DocumentedLocalNamedParameter)injector.GetInstance(documentedLocalNamedParameterType);
- Assert.IsNotNull(doc);
+ Assert.NotNull(doc);
var s = doc.ToString();
}
- [TestMethod]
+ [Fact]
public void TestTimerConfigurationWithClassHierarchy()
{
Type timerType = typeof(Timer);
@@ -427,11 +421,11 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector injector = tang1.NewInjector(conf1);
var timer = (Timer)injector.GetInstance(timerType);
- Assert.IsNotNull(timer);
+ Assert.NotNull(timer);
timer.sleep();
}
- [TestMethod]
+ [Fact]
public void TestSetConfig()
{
IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder()
@@ -449,12 +443,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Box b2 = (Box)TangFactory.GetTang().NewInjector(conf2).GetInstance(typeof(Box));
ISet<string> actual = b2.Numbers;
- Assert.IsTrue(actual.Contains("four"));
- Assert.IsTrue(actual.Contains("five"));
- Assert.IsTrue(actual.Contains("six"));
+ Assert.True(actual.Contains("four"));
+ Assert.True(actual.Contains("five"));
+ Assert.True(actual.Contains("six"));
}
- [TestMethod]
+ [Fact]
public void TestSetConfigWithAvroSerialization()
{
IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder()
@@ -472,12 +466,12 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Box b2 = (Box)TangFactory.GetTang().NewInjector(conf2).GetInstance(typeof(Box));
ISet<string> actual = b2.Numbers;
- Assert.IsTrue(actual.Contains("four"));
- Assert.IsTrue(actual.Contains("five"));
- Assert.IsTrue(actual.Contains("six"));
+ Assert.True(actual.Contains("four"));
+ Assert.True(actual.Contains("five"));
+ Assert.True(actual.Contains("six"));
}
- [TestMethod]
+ [Fact]
public void TestNullStringValue()
{
string msg = null;
@@ -491,10 +485,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
{
msg = e.Message;
}
- Assert.IsNotNull(msg);
+ Assert.NotNull(msg);
}
- [TestMethod]
+ [Fact]
public void TestSetConfigNullValue()
{
string msg = null;
@@ -510,7 +504,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
{
msg = e.Message;
}
- Assert.IsNotNull(msg);
+ Assert.NotNull(msg);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
index 3740fd7..d60827f 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestCsConfigurationBuilderExtension.cs
@@ -18,22 +18,21 @@
*/
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Tests.Injection;
using Org.Apache.REEF.Tang.Tests.Tang;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Configuration
{
/// <summary>
/// This class is to test extension API defined in ICsConfigurationBuilder
/// </summary>
- [TestClass]
public class TestCsConfigurationBuilderExtension
{
- [TestMethod]
+ [Fact]
public void TestBindNamedParameter1()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -45,11 +44,11 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Aimpl a2 = (Aimpl)i.GetNamedInstance<AImplName, INamedImplA>(GenericType<AImplName>.Class);
Bimpl b1 = (Bimpl)i.GetNamedInstance<BImplName, INamedImplA>(GenericType<BImplName>.Class);
Bimpl b2 = (Bimpl)i.GetNamedInstance<BImplName, INamedImplA>(GenericType<BImplName>.Class);
- Assert.AreSame(a1, a2);
- Assert.AreSame(b1, b2);
+ Assert.Same(a1, a2);
+ Assert.Same(b1, b2);
}
- [TestMethod]
+ [Fact]
public void TestBindStringNamedParam()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -59,7 +58,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
o.Verify("foo");
}
- [TestMethod]
+ [Fact]
public void TestBindIntNamedParam()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -69,7 +68,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
o.Verify(8);
}
- [TestMethod]
+ [Fact]
public void TestBindNamedParam()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -79,7 +78,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
o.Verify(true);
}
- [TestMethod]
+ [Fact]
public void TestBindSetEntryImplValue()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
@@ -92,10 +91,10 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
ISet<INumber> expected = new HashSet<INumber>();
expected.Add(new TestSetInjection.Integer1(4));
- Assert.IsTrue(Utilities.Utilities.Equals<INumber>(actual, expected));
+ Assert.True(Utilities.Utilities.Equals<INumber>(actual, expected));
}
- [TestMethod]
+ [Fact]
public void TestBindSetEntryStringValue()
{
IConfiguration conf = TangFactory.GetTang().NewConfigurationBuilder()
@@ -107,21 +106,21 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
Box b = (Box)TangFactory.GetTang().NewInjector(conf).GetInstance(typeof(Box));
ISet<string> actual = b.Numbers;
- Assert.IsTrue(actual.Contains("four"));
- Assert.IsTrue(actual.Contains("five"));
- Assert.IsTrue(actual.Contains("six"));
+ Assert.True(actual.Contains("four"));
+ Assert.True(actual.Contains("five"));
+ Assert.True(actual.Contains("six"));
}
- [TestMethod]
+ [Fact]
public void TestBindImplementation()
{
ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
cb.BindImplementation<Interf, Impl>();
Interf o = TangFactory.GetTang().NewInjector(cb.Build()).GetInstance<Interf>();
- Assert.IsTrue(o is Impl);
+ Assert.True(o is Impl);
}
- [TestMethod]
+ [Fact]
public void TestBindList()
{
IList<string> injected = new List<string>();
@@ -135,13 +134,13 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IInjector i = TangFactory.GetTang().NewInjector(cb.Build());
IList<string> actual = ((StringClass)i.GetInstance(typeof(StringClass))).StringList;
- Assert.IsTrue(actual.Contains("hi"));
- Assert.IsTrue(actual.Contains("hello"));
- Assert.IsTrue(actual.Contains("bye"));
- Assert.AreEqual(actual.Count, 3);
+ Assert.True(actual.Contains("hi"));
+ Assert.True(actual.Contains("hello"));
+ Assert.True(actual.Contains("bye"));
+ Assert.Equal(actual.Count, 3);
}
- [TestMethod]
+ [Fact]
public void TestObjectInjectWithInjectableSubclassesMultipleInstances()
{
IList<string> injected = new List<string>();
@@ -158,13 +157,13 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration
IList<INumber> actual = ((PoolListClass)i.GetInstance(typeof(PoolListClass))).Numbers;
- Assert.IsTrue(actual.Count == 3);
- Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5)));
- Assert.IsTrue(actual.Contains(new TestSetInjection.Integer1(5)));
- Assert.IsTrue(actual.Contains(new TestSetInjection.Float1(12.5f)));
+ Assert.True(actual.Count == 3);
+ Assert.True(actual.Contains(new TestSetInjection.Integer1(5)));
+ Assert.True(actual.Contains(new TestSetInjection.Integer1(5)));
+ Assert.True(actual.Contains(new TestSetInjection.Float1(12.5f)));
}
- [TestMethod]
+ [Fact]
public void TestBindConstructor()
{
ICsConfigurationBuilder b = TangFactory.GetTang().NewConfigurationBuilder();
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
index 15f2d7c..b0da309 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModule.cs
@@ -19,13 +19,13 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Exceptions;
using Org.Apache.REEF.Tang.Formats;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Format
{
@@ -38,30 +38,9 @@ namespace Org.Apache.REEF.Tang.Tests.Format
{
}
- [TestClass]
public class TestConfigurationModule
{
- [ClassInitialize]
- public static void ClassSetup(TestContext context)
- {
- }
-
- [ClassCleanup]
- public static void ClassCleanup()
- {
- }
-
- [TestInitialize]
- public void TestSetup()
- {
- }
-
- [TestCleanup]
- public void TestCleanup()
- {
- }
-
- [TestMethod]
+ [Fact]
public void SmokeTest()
{
// Here we set some configuration values. In true tang style,
@@ -74,10 +53,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.FooNess, "12")
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(fooType);
- Assert.AreEqual(f.getFooness(), 12);
+ Assert.Equal(f.getFooness(), 12);
}
- [TestMethod]
+ [Fact]
public void SmokeTestConfig()
{
// Here we set some configuration values. In true tang style,
@@ -90,32 +69,32 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.FooNess, "12")
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(fooType);
- Assert.AreEqual(f.getFooness(), 12);
+ Assert.Equal(f.getFooness(), 12);
AvroConfigurationSerializer serializerCs = new AvroConfigurationSerializer();
serializerCs.ToFileStream(c, "TangTestCs.avroconf");
var c3 = serializerCs.FromFileStream("TangTestCs.avroconf");
IFoo f3 = (IFoo)TangFactory.GetTang().NewInjector(c3).GetInstance(fooType);
- Assert.AreEqual(f3.getFooness(), 12);
+ Assert.Equal(f3.getFooness(), 12);
serializerCs.ToFile(c, "TangTestCs1.avro");
var c4 = serializerCs.FromFile("TangTestCs1.avro");
IFoo f4 = (IFoo)TangFactory.GetTang().NewInjector(c4).GetInstance(fooType);
- Assert.AreEqual(f4.getFooness(), 12);
+ Assert.Equal(f4.getFooness(), 12);
IConfigurationSerializer serializerImpl = (IConfigurationSerializer)TangFactory.GetTang().NewInjector().GetInstance(typeof(IConfigurationSerializer));
serializerImpl.ToFile(c, "TangTestCs1.avro");
var c5 = serializerImpl.FromFile("TangTestCs1.avro");
IFoo f5 = (IFoo)TangFactory.GetTang().NewInjector(c5).GetInstance(fooType);
- Assert.AreEqual(f5.getFooness(), 12);
+ Assert.Equal(f5.getFooness(), 12);
// this is to test the file generated from Java. name,value b=must be recognized by C# class hierarchy
AvroConfigurationSerializer serializer = new AvroConfigurationSerializer();
var avroConfig = serializer.AvroDeserializeFromFile("Evaluator.conf");
- Assert.IsNotNull(avroConfig);
+ Assert.NotNull(avroConfig);
}
- [TestMethod]
+ [Fact]
public void OmitOptionalTest()
{
Type fooType = typeof(Org.Apache.REEF.Tang.Tests.Format.IFoo);
@@ -124,10 +103,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.TheFoo, GenericType<FooImpl>.Class)
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(fooType);
- Assert.AreEqual(f.getFooness(), 42);
+ Assert.Equal(f.getFooness(), 42);
}
- [TestMethod]
+ [Fact]
public void OmitRequiredTest()
{
string msg = null;
@@ -141,10 +120,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void BadConfTest()
{
string msg = null;
@@ -156,16 +135,16 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void NonExistentStringBindOK()
{
new MyBadConfigurationModule().BindImplementation(GenericType<IFoo>.Class, "i.do.not.exist");
}
- [TestMethod]
+ [Fact]
public void NonExistentStringBindNotOK()
{
string msg = null;
@@ -177,10 +156,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void MultiBindTest()
{
// Here we set some configuration values. In true tang style,
@@ -192,12 +171,12 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
IFoo f = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(typeof(IFoo));
IFoo g = (IFoo)TangFactory.GetTang().NewInjector(c).GetInstance(typeof(object));
- Assert.AreEqual(f.getFooness(), 12);
- Assert.AreEqual(g.getFooness(), 12);
- Assert.IsFalse(f == g);
+ Assert.Equal(f.getFooness(), 12);
+ Assert.Equal(g.getFooness(), 12);
+ Assert.False(f == g);
}
- [TestMethod]
+ [Fact]
public void ForeignSetTest()
{
string msg = null;
@@ -209,10 +188,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void ForeignBindTest()
{
string msg = null;
@@ -224,10 +203,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (Exception)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void SingletonTest()
{
IConfiguration c = new MyConfigurationModule()
@@ -237,17 +216,17 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(MyConfigurationModule.TheFoo, GenericType<FooImpl>.Class)
.Build();
IInjector i = TangFactory.GetTang().NewInjector(c);
- Assert.IsTrue(i.GetInstance(typeof(IFoo)) == i.GetInstance(typeof(IFoo)));
+ Assert.True(i.GetInstance(typeof(IFoo)) == i.GetInstance(typeof(IFoo)));
}
- [TestMethod]
+ [Fact]
public void ImmutablilityTest()
{
// builder methods return copies; the original module is immutable
ConfigurationModule builder1 = MyConfigurationModule.Conf
.Set(MyConfigurationModule.TheFoo, GenericType<FooImpl>.Class);
- Assert.IsFalse(builder1 == MyConfigurationModule.Conf);
+ Assert.False(builder1 == MyConfigurationModule.Conf);
IConfiguration config1 = builder1.Build();
@@ -259,11 +238,11 @@ namespace Org.Apache.REEF.Tang.Tests.Format
// instantiation of each just to be sure everything is fine in this situation
IInjector i1 = TangFactory.GetTang().NewInjector(config1);
IInjector i2 = TangFactory.GetTang().NewInjector(config2);
- Assert.AreEqual(42, ((IFoo)i1.GetInstance(typeof(IFoo))).getFooness());
- Assert.AreEqual(7, ((IFoo)i2.GetInstance(typeof(IFoo))).getFooness());
+ Assert.Equal(42, ((IFoo)i1.GetInstance(typeof(IFoo))).getFooness());
+ Assert.Equal(7, ((IFoo)i2.GetInstance(typeof(IFoo))).getFooness());
}
- [TestMethod]
+ [Fact]
public void SetParamTest()
{
IConfiguration c = SetConfigurationModule.CONF
@@ -272,12 +251,12 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
ISet<string> s = (ISet<string>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(SetName));
- Assert.AreEqual(s.Count, 2);
- Assert.IsTrue(s.Contains("a"));
- Assert.IsTrue(s.Contains("b"));
+ Assert.Equal(s.Count, 2);
+ Assert.True(s.Contains("a"));
+ Assert.True(s.Contains("b"));
}
- [TestMethod]
+ [Fact]
public void SetClassTest()
{
IConfiguration c = SetClassConfigurationModule.CONF
@@ -285,7 +264,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Set(SetClassConfigurationModule.P, GenericType<SubB>.Class)
.Build();
ISet<ISuper> s = (ISet<ISuper>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(SetClass));
- Assert.AreEqual(2, s.Count);
+ Assert.Equal(2, s.Count);
bool sawA = false, sawB = false;
foreach (ISuper sup in s)
@@ -300,13 +279,13 @@ namespace Org.Apache.REEF.Tang.Tests.Format
}
else
{
- Assert.Fail();
+ Assert.True(false);
}
}
- Assert.IsTrue(sawA && sawB);
+ Assert.True(sawA && sawB);
}
- [TestMethod]
+ [Fact]
public void SetClassRoundTripTest()
{
IConfiguration c = SetClassConfigurationModule.CONF
@@ -320,7 +299,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
// ConfigurationFile.AddConfiguration(cb, ConfigurationFile.ToConfigurationString(c));
ISet<ISuper> s = (ISet<ISuper>)TangFactory.GetTang().NewInjector(c2).GetNamedInstance(typeof(SetClass));
- Assert.AreEqual(2, s.Count);
+ Assert.Equal(2, s.Count);
bool sawA = false, sawB = false;
foreach (ISuper sup in s)
{
@@ -334,13 +313,13 @@ namespace Org.Apache.REEF.Tang.Tests.Format
}
else
{
- Assert.Fail();
+ Assert.True(false);
}
}
- Assert.IsTrue(sawA && sawB);
+ Assert.True(sawA && sawB);
}
- [TestMethod]
+ [Fact]
public void ErrorOnStaticTimeSet()
{
string msg = null;
@@ -353,10 +332,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
catch (ClassHierarchyException)
{
}
- Assert.IsNull(msg);
+ Assert.Null(msg);
}
- [TestMethod]
+ [Fact]
public void ErrorOnSetMerge()
{
ConfigurationModuleBuilder cb = null;
@@ -369,7 +348,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
{
System.Diagnostics.Debug.WriteLine(e);
}
- Assert.IsNull(cb);
+ Assert.Null(cb);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
index d5fb873..ceea35b 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestConfigurationModuleForList.cs
@@ -19,12 +19,12 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Formats;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Format
{
@@ -32,12 +32,11 @@ namespace Org.Apache.REEF.Tang.Tests.Format
{
}
- [TestClass]
public class TestConfigurationModuleForList
{
// ConfigurationModuleBuilder BindList<U, T>(GenericType<U> iface, IParam<IList<T>> opt)
// public ConfigurationModule Set<T>(IImpl<IList<T>> opt, IList<string> impl)
- [TestMethod]
+ [Fact]
public void ListParamTest()
{
IList<string> v = new List<string>();
@@ -49,14 +48,14 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
IList<string> s = (IList<string>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(ListName));
- Assert.AreEqual(s.Count, 2);
- Assert.IsTrue(s.Contains("a"));
- Assert.IsTrue(s.Contains("b"));
+ Assert.Equal(s.Count, 2);
+ Assert.True(s.Contains("a"));
+ Assert.True(s.Contains("b"));
}
// public ConfigurationModuleBuilder BindList<U, T>(GenericType<U> iface, IImpl<IList<T>> opt) where U : Name<IList<T>>
// public ConfigurationModule Set<T>(IImpl<IList<T>> opt, IList<Type> impl)
- [TestMethod]
+ [Fact]
public void ListImplTest()
{
IList<Type> v = new List<Type>();
@@ -68,22 +67,22 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
IList<IListSuper> s = (IList<IListSuper>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(ListClass));
- Assert.AreEqual(s.Count, 2);
- Assert.IsTrue(s[0] is ListSubA);
- Assert.IsTrue(s[1] is ListSubB);
+ Assert.Equal(s.Count, 2);
+ Assert.True(s[0] is ListSubA);
+ Assert.True(s[1] is ListSubB);
}
// public ConfigurationModuleBuilder BindList<U, T>(GenericType<U> iface, IList<string> impl)
- [TestMethod]
+ [Fact]
public void ListStringTest()
{
IConfiguration c = ListIntConfigurationModule.CONF
.Build();
IList<int> i = (IList<int>)TangFactory.GetTang().NewInjector(c).GetNamedInstance(typeof(ListIntName));
- Assert.AreEqual(i.Count, 2);
- Assert.IsTrue(i.Contains(1));
- Assert.IsTrue(i.Contains(2));
+ Assert.Equal(i.Count, 2);
+ Assert.True(i.Contains(1));
+ Assert.True(i.Contains(2));
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
index 14cc1ce..099f993 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Format/TestTaskConfiguration.cs
@@ -19,7 +19,6 @@
using System;
using System.Collections.Generic;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Common.Tasks;
using Org.Apache.REEF.Examples.Tasks.HelloTask;
using Org.Apache.REEF.Tang.Annotations;
@@ -27,6 +26,7 @@ using Org.Apache.REEF.Tang.Formats;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Format
{
@@ -65,10 +65,9 @@ namespace Org.Apache.REEF.Tang.Tests.Format
string GetId();
}
- [TestClass]
public class TestTaskConfiguration
{
- [TestMethod]
+ [Fact]
public void TaskConfigurationTestWith3Parameters()
{
TaskConfigurationWith3Parameters.Conf
@@ -76,7 +75,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
}
- [TestMethod]
+ [Fact]
public void TaskConfigurationWithMyEventHandlerTest()
{
TaskConfigurationWithMyEventHandler.Conf
@@ -84,7 +83,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
.Build();
}
- [TestMethod]
+ [Fact]
public void TaskConfigurationTest()
{
IConfiguration conf1 = TaskConfiguration.Conf
@@ -104,7 +103,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector1 = TangFactory.GetTang().NewInjector(conf1);
var task1 = (HelloTask)injector1.GetInstance(typeof(ITask));
- Assert.IsNotNull(task1);
+ Assert.NotNull(task1);
var serializer = new AvroConfigurationSerializer();
byte[] bytes = serializer.ToByteArray(conf1);
@@ -112,10 +111,10 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector2 = TangFactory.GetTang().NewInjector(conf2);
var task2 = (HelloTask)injector2.GetInstance(typeof(ITask));
- Assert.IsNotNull(task2);
+ Assert.NotNull(task2);
}
- [TestMethod]
+ [Fact]
public void TaskConfigurationSerializationTest()
{
IConfiguration conf1 = TaskConfiguration.Conf
@@ -132,7 +131,7 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector1 = TangFactory.GetTang().NewInjector(conf1);
var task1 = (HelloTask)injector1.GetInstance(typeof(ITask));
- Assert.IsNotNull(task1);
+ Assert.NotNull(task1);
var serializer = new AvroConfigurationSerializer();
byte[] bytes = serializer.ToByteArray(conf1);
@@ -140,14 +139,14 @@ namespace Org.Apache.REEF.Tang.Tests.Format
IInjector injector2 = TangFactory.GetTang().NewInjector(conf2);
var task2 = (HelloTask)injector2.GetInstance(typeof(ITask));
- Assert.IsNotNull(task2);
+ Assert.NotNull(task2);
serializer.ToFileStream(conf1, "TaskConfiguration.bin");
IConfiguration conf3 = serializer.FromFileStream("TaskConfiguration.bin");
IInjector injector3 = TangFactory.GetTang().NewInjector(conf3);
var task3 = (HelloTask)injector3.GetInstance(typeof(ITask));
- Assert.IsNotNull(task3);
+ Assert.NotNull(task3);
}
}
http://git-wip-us.apache.org/repos/asf/reef/blob/9c36dba5/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
index 56b9d52..e52c4b8 100644
--- a/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
+++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Injection/TestAmbigousConstructors.cs
@@ -17,19 +17,18 @@
* under the License.
*/
-using Microsoft.VisualStudio.TestTools.UnitTesting;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Exceptions;
using Org.Apache.REEF.Tang.Implementations.Tang;
using Org.Apache.REEF.Tang.Interface;
using Org.Apache.REEF.Tang.Util;
+using Xunit;
namespace Org.Apache.REEF.Tang.Tests.Injection
{
- [TestClass]
public class TestAmbigousConstructors
{
- [TestMethod]
+ [Fact]
public void AmbigousConstructorTest()
{
// Cannot inject Org.Apache.REEF.Tang.Tests.Injection.AmbigousConstructorClass, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
@@ -50,7 +49,7 @@ namespace Org.Apache.REEF.Tang.Tests.Injection
{
System.Diagnostics.Debug.WriteLine(e);
}
- Assert.IsNull(obj);
+ Assert.Null(obj);
}
}