Home > Net >  How to check that they belong to the same class in c test Visual Studio?
How to check that they belong to the same class in c test Visual Studio?

Time:05-24

I want to check if the constructor is initialized correctly, but I don't know which assert method to use

TEST_METHOD(testInitNavigator)
        {
            Room room;
            INavigator navigator(room);
            Assert::AreSame(room, navigator.getLocalRoom());
        }

CodePudding user response:

I think it is correct so

        TEST_METHOD(testInitNavigator)
        {
            Room room;
            INavigator navigator(room);
            Assert::IsTrue(typeid(room).name() == typeid(navigator.getLocalRoom()).name());
        }
  • Related