This issue is unrelated to RhinoMocks (e.g., there's nothing about RM that would prevent VS2012 from properly displaying your tests in the VS test-runner). I have three suggestions to explore:
1. Try to create a completely new solution with a single MSTEST test in it and see if VS2012 can properly display that test (should demonstrate/isolate your issue from RhinoMocks) 2. The post you mentioned was re: using MbUnit but you're using the [TestMethod] attribute (from MSTest) in your code -- ensure that you're using the testing framework you think you are 3. Did you build/compile the solution at least once? AFAIK the VS test-runner reflects over the build assemblies to 'discover' the test methods so you must build/compile the solution/projects at least once for them to properly appear in the VS2012 test-runner. HTH, -Steve B. Steve Bohlen sboh...@gmail.com http://blog.unhandled-exceptions.com http://twitter.com/sbohlen On Wed, Dec 5, 2012 at 2:31 AM, littlechap22 <littlecha...@gmail.com> wrote: > Hi, > > I am a newbie in testing frameworks and rhino mocks is the first one I am > trying to implement in visual studio 2012 for a c# project. > > I have included the rhino mocks *.dll as a reference and made two classes > in a single project. > > I got the code from @ > http://aspalliance.com/1400_Beginning_to_Mock_with_Rhino_Mocks_and_MbUnit__Part_1.4 > > program.cs > ==== > using System; > using System.Collections.Generic; > using System.Linq; > using System.Text; > > namespace SampleRhinoMocksTestingApplication > { > class Program > { > static void Main(string[] args) > { > ImageManagement image = new ImageManagement(); > string path = image.GetImageForTimeOfDay(new > DateTimeController()); > Console.WriteLine(path); > Console.ReadLine(); > } > } > > public class DateTimeController : IDateTime > { > public int GetHour() > { > return DateTime.Now.Hour; > } > } > > public class ImageManagement > { > public string GetImageForTimeOfDay(IDateTime time) > { > int currentHour = time.GetHour(); > > if (currentHour > 6 && currentHour < 21) > { > return "sun.jpg"; > } > else > { > return "moon.jpg"; > } > } > } > > public interface IDateTime > { > int GetHour(); > } > } > ==== > > TestClass.cs > ==== > using Microsoft.VisualStudio.TestTools.UnitTesting; > using System; > using System.Collections.Generic; > using System.Linq; > using System.Text; > using Rhino.Mocks; > using SampleRhinoMocksTestingApplication; > > namespace RhinoTests > { > [TestClass] > class Program > { > [TestMethod] > public void DaytimeTest() > { > MockRepository mocks = new MockRepository(); > IDateTime timeController = mocks.StrictMock<IDateTime>(); > > using (mocks.Record()) > { > Expect.Call(timeController.GetHour()).Return(15); > } > > using (mocks.Playback()) > { > string expectedImagePath = "sun.jpg"; > ImageManagement image = new ImageManagement(); > string path = image.GetImageForTimeOfDay(timeController); > Assert.AreEqual(expectedImagePath, path); > } > } > > [TestMethod] > public void NighttimeTest() > { > MockRepository mocks = new MockRepository(); > IDateTime timeController = mocks.StrictMock<IDateTime>(); > using (mocks.Record()) > { > Expect.Call(timeController.GetHour()).Return(1); > } > > using (mocks.Playback()) > { > string expectedImagePath = "moon.jpg"; > ImageManagement image = new ImageManagement(); > string path = image.GetImageForTimeOfDay(timeController); > Assert.AreEqual(expectedImagePath, path); > } > } > } > } > ==== > > I have been able to build the project successfully. > > But when I go to menu bar in visual studio 2012 to; Test -> Windows -> > Test Explorer; the test explorer open but I am unable to find any of the > test methods in the list. > > I have search the internet for configuring up rhino mocks in visual studio > 2012 but unable to find a good guide. Please let me know to how to set up > the framework or anything I am missing. > > Thanks. > > -littlechap22 > > -- > You received this message because you are subscribed to the Google Groups > "Rhino.Mocks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/rhinomocks/-/LEpigLEIxB0J. > To post to this group, send email to rhinomocks@googlegroups.com. > To unsubscribe from this group, send email to > rhinomocks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rhinomocks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to rhinomocks@googlegroups.com. To unsubscribe from this group, send email to rhinomocks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.