© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago
moi15moi

✅ NUnit don't execute my test

I am trying to use
NUnit
NUnit
to test my package.
I am a total newbie in c#.

Why could visual studio ignore my test when I run them?
I saw this stackoverflow thread: https://stackoverflow.com/questions/23363073/tests-not-running-in-test-explorer?page=2&tab=scoredesc#tab-top

I tried to do the command
Update-Package NUnit -reinstall
Update-Package NUnit -reinstall
in powershell, but it fails (see the image)

Here is my test file
using NUnit.Framework;


namespace Data
{
    [TestFixture]
    public class CSVFactoryTest
    {
        [SetUp]
        public void Setup()
        {

        }

        [Test]
        public void CreateGroupFromCSVFile_Test()
        {
            List<Group> groups = CSVFactory.CreateGroupFromCSVFile("groups.csv");
            List<Group> expected_groups = new List<Group>
            {
                new Group(1, new Data(50, 100)),
                new Group(2, new Data(100, 150)),
                new Group(3, new Data(150, 200)),
                new Group(4, new Data(200, 250)),
                new Group(5, new Data(250, 300))
            };

            CollectionAssert.AreEqual(expected_groups, groups);
        }


        [Test]
        public void CreateDataFromCSVFile_Test()
        {
            List<Data> datas = CSVFactory.CreateDataFromCSVFile("data.csv");
            List<Data> expected_datas = new List<Data>
            {
                new Data(104, 162),
                new Data(291, 349),

            };

            CollectionAssert.AreEqual(expected_datas, datas);
        }
    }
}
using NUnit.Framework;


namespace Data
{
    [TestFixture]
    public class CSVFactoryTest
    {
        [SetUp]
        public void Setup()
        {

        }

        [Test]
        public void CreateGroupFromCSVFile_Test()
        {
            List<Group> groups = CSVFactory.CreateGroupFromCSVFile("groups.csv");
            List<Group> expected_groups = new List<Group>
            {
                new Group(1, new Data(50, 100)),
                new Group(2, new Data(100, 150)),
                new Group(3, new Data(150, 200)),
                new Group(4, new Data(200, 250)),
                new Group(5, new Data(250, 300))
            };

            CollectionAssert.AreEqual(expected_groups, groups);
        }


        [Test]
        public void CreateDataFromCSVFile_Test()
        {
            List<Data> datas = CSVFactory.CreateDataFromCSVFile("data.csv");
            List<Data> expected_datas = new List<Data>
            {
                new Data(104, 162),
                new Data(291, 349),

            };

            CollectionAssert.AreEqual(expected_datas, datas);
        }
    }
}
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

write nunit test
C#CC# / help
2y ago
Issues running BenchmarkDotNet fron NUnit test
C#CC# / help
11mo ago
NUnit test with Asp net web API
C#CC# / help
17mo ago
✅ Trying out NUnit test, I need help!
C#CC# / help
2y ago