Click here to Skip to main content
15,885,934 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using the NUnit framework for unit testing.

My question is that in NUnit I am getting the error "MolopolyGame.Testing._Card.TestConstructor:
No arguments were provided"

The method which i am testing returns a random item in an array.

I have a method which i need to test

C#
public string GetCommunityCard()
        {
            //generate random community card
            int card;
            Random randomCommunityCard = new Random();
            card = randomCommunityCard.Next(communityChestCardArray.Length);
            return communityChestCardArray[card];
        }



and this is the test that I have written so far for the method

C#
namespace MolopolyGame.Testing
{
    [TestFixture]
    public class _Card
    {
        [Test]
        public void TestConstructor(string retArray)
        {
            Card Card = new Card();
            string myCard = Card.GetCommunityCard();

            Assert.AreEqual(myCard, retArray);
        }
    }
}




I am not too sure what I am doing wrong?

Thank you
Posted
Updated 5-Nov-14 17:16pm
v3

1 solution

return communityChestCardArray[card].ToString() needs to be added in the actual method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900