Created
February 14, 2010 15:57
-
-
Save agross/304102 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Dynamic; | |
using Machine.Specifications; | |
namespace ClassLibrary1 | |
{ | |
public class DynamicClass | |
{ | |
public dynamic DoSomething() | |
{ | |
dynamic foo = new ExpandoObject(); | |
foo.Bar = "baz"; | |
return foo; | |
} | |
} | |
public class When_Context | |
{ | |
static DynamicClass Sut; | |
static dynamic Result; | |
Establish context = () => { Sut = new DynamicClass(); }; | |
Because of = () => { Result = Sut.DoSomething(); }; | |
It should_ = () => Result.Bar.ShouldEqual("baz"); | |
} | |
} | |
using ClassLibrary1; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace TestProject1 | |
{ | |
[TestClass] | |
public class UnitTest1 | |
{ | |
[TestMethod] | |
public void TestMethod1() | |
{ | |
DynamicClass Sut; | |
dynamic Result; | |
Sut = new DynamicClass(); | |
Result = Sut.DoSomething(); | |
Assert.AreEqual(Result.Bar, "baz"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment