This is a migrated thread and some comments may be shown as answers.

How to run tests with Mock.SetupStatic using MSTEST

2 Answers 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Max
Top achievements
Rank 1
Max asked on 17 Jul 2012, 07:44 AM
I am new to the framework so I guess it is just something I did not do before invoke the test case using MSTEST.

Created the test as following

        public class Foo
        {
            public static int Execute(int arg) { throw new NotImplementedException(); }
        }

        [TestMethod]
        public void TestMethod1()
        {
            Mock.SetupStatic<Foo>(Behavior.Strict);
            Mock.Arrange(() => Foo.Execute(0)).Returns(10);
            Foo.Execute(0);
        }

Got a passed test case within VS2012 environment. 

When I do commandline "mstest /testcontainer:test.dll", the case failed. Anything I need to do before running MSTEST?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Max
Top achievements
Rank 1
answered on 19 Jul 2012, 06:12 AM
Sorry for starting this thread. I am just a bit hasty. I should read through the help file completely before posting this question.

Just for information, use JustMockRunner.exe as a wrapper application then the case will pass.

Max
0
Ricky
Telerik team
answered on 20 Jul 2012, 10:54 PM
Hi Max,

It's great that you have figured it out. Should you need any other information please don't hesitate contact us.

 

Kind Regards
Ricky
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
Max
Top achievements
Rank 1
Answers by
Max
Top achievements
Rank 1
Ricky
Telerik team
Share this question
or