littlechap22 | 5 Dec 08:31 2012
Picon

rhino mocks, visual studio 2012, c# : setup, configure?

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 <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
Mark Wilkinson | 5 Dec 18:44 2012
Picon

Re: rhino mocks, visual studio 2012, c# : setup, configure?

Also, I'm running short on time getting Mountain Lion installed.

I'm installing it now, it wouldn't download from my wifi last night for whatever reason, we have had bad ATT service for the last couple of weeks for the DSL.  So I brought it to work this morning downloaded it, tried making a bootable USB drive without success, then started installing it an hour ago, it's still installing, after it finishes I need to go into the Recovery mode and reformat, then reinstall so it's a fresh install with all of my profile and apps gone.  Hopefully this is completed by 1, if not would you be able to meet maybe an hour later like 2?

let me know.

I can meet anytime after 1 all the way up until 4-5.

From: littlechap22 <littlechap22 <at> gmail.com>
To: rhinomocks <at> googlegroups.com
Cc: littlechap22 <at> gmail.com
Sent: Wednesday, December 5, 2012 1:31 AM
Subject: [RhinoMocks] rhino mocks, visual studio 2012, c# : setup, configure?

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 <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.

Mark Wilkinson | 5 Dec 18:44 2012
Picon

Re: rhino mocks, visual studio 2012, c# : setup, configure?

sorry guys, sent out an email that was meant for someone else, ignore.

-mark

From: littlechap22 <littlechap22 <at> gmail.com>
To: rhinomocks <at> googlegroups.com
Cc: littlechap22 <at> gmail.com
Sent: Wednesday, December 5, 2012 1:31 AM
Subject: [RhinoMocks] rhino mocks, visual studio 2012, c# : setup, configure?

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 <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.

Stephen Bohlen | 5 Dec 18:58 2012
Picon

Re: rhino mocks, visual studio 2012, c# : setup, configure?

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
sbohlen <at> gmail.com
http://blog.unhandled-exceptions.com
http://twitter.com/sbohlen


On Wed, Dec 5, 2012 at 2:31 AM, littlechap22 <littlechap22 <at> 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 <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> 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 <at> googlegroups.com.
To unsubscribe from this group, send email to rhinomocks+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
hesselmann | 24 Jun 08:08 2013
Picon

Re: rhino mocks, visual studio 2012, c# : setup, configure?

The root cause could be the visibility of the test class.

Reason why I raise my point of view is that I could run the two test cases below after make the test class public.



Am Mittwoch, 5. Dezember 2012 08:31:53 UTC+1 schrieb littlechap22:


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]
   public    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 unsubscribe from this group and stop receiving emails from it, send an email to rhinomocks+unsubscribe <at> googlegroups.com.
To post to this group, send email to rhinomocks <at> googlegroups.com.
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
cyberwillis | 24 Jun 11:24 2013
Picon

Re: Re: rhino mocks, visual studio 2012, c# : setup, configure?

I don´t know why are you using this:

using SampleRhinoMocksTestingApplication;

Anyway have you referenced the DLL correctly ?


On Mon, Jun 24, 2013 at 3:08 AM, hesselmann <margret.hesselmann <at> gmail.com> wrote:
The root cause could be the visibility of the test class.

Reason why I raise my point of view is that I could run the two test cases below after make the test class public.



Am Mittwoch, 5. Dezember 2012 08:31:53 UTC+1 schrieb littlechap22:

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]
   public    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 unsubscribe from this group and stop receiving emails from it, send an email to rhinomocks+unsubscribe <at> googlegroups.com.

To post to this group, send email to rhinomocks <at> googlegroups.com.
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rhinomocks+unsubscribe <at> googlegroups.com.
To post to this group, send email to rhinomocks <at> googlegroups.com.
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gmane