Skip to content

Commit

Permalink
Update test to be more accurate.
Browse files Browse the repository at this point in the history
  • Loading branch information
abeltrano committed Jan 22, 2024
1 parent ea87cf2 commit 1fe4fbf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/unit/linux/wifi/core/TestAccessPointFactoryLinux.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,34 @@ TEST_CASE("Create() function", "[wifi][core][ap][linux]")
{
using namespace Microsoft::Net::Wifi;

using Microsoft::Net::Netlink::Nl80211::Nl80211Interface;

SECTION("Create() doesn't cause a crash")
{
auto createArgs = std::make_unique<AccessPointCreateArgsLinux>(Nl80211Interface{});
AccessPointFactoryLinux accessPointFactory{ std::make_unique<Test::AccessPointControllerFactoryTest>() };
REQUIRE_NOTHROW(accessPointFactory.Create(Test::InterfaceNameDefault));
REQUIRE_NOTHROW(accessPointFactory.Create(Test::InterfaceNameDefault, std::move(createArgs)));
}

SECTION("Create() with empty/null inteface doesn't cause a crash")
{
auto createArgs = std::make_unique<AccessPointCreateArgsLinux>(Nl80211Interface{});
AccessPointFactoryLinux accessPointFactory{ std::make_unique<Test::AccessPointControllerFactoryTest>() };
REQUIRE_NOTHROW(accessPointFactory.Create({}));
REQUIRE_NOTHROW(accessPointFactory.Create({}, std::move(createArgs)));
}

SECTION("Create() with valid input arguments returns non-nullptr instance")
{
auto createArgs = std::make_unique<AccessPointCreateArgsLinux>(Nl80211Interface{});
AccessPointFactoryLinux accessPointFactory{ std::make_unique<Test::AccessPointControllerFactoryTest>() };
REQUIRE(accessPointFactory.Create(Test::InterfaceNameDefault) != nullptr);
REQUIRE(accessPointFactory.Create(Test::InterfaceNameDefault, std::move(createArgs)) != nullptr);
}

SECTION("Create() instance reflects basic properties from base class")
{
auto createArgs = std::make_unique<AccessPointCreateArgsLinux>(Nl80211Interface{});
AccessPointFactoryLinux accessPointFactory{ std::make_unique<Test::AccessPointControllerFactoryTest>() };
const auto accessPoint = accessPointFactory.Create(Test::InterfaceNameDefault);
const auto accessPoint = accessPointFactory.Create(Test::InterfaceNameDefault, std::move(createArgs));
REQUIRE(accessPoint->GetInterfaceName() == Test::InterfaceNameDefault);
}
}

0 comments on commit 1fe4fbf

Please sign in to comment.