diff options
Diffstat (limited to 'domain/tests')
| -rw-r--r-- | domain/tests/participant.cpp | 80 |
1 files changed, 69 insertions, 11 deletions
diff --git a/domain/tests/participant.cpp b/domain/tests/participant.cpp index 268b395..6db98f7 100644 --- a/domain/tests/participant.cpp +++ b/domain/tests/participant.cpp @@ -9,7 +9,7 @@ namespace turns::domain::tests { - TEST_CASE("A participant") + TEST_CASE("A freshly constructed participant") { auto constexpr constructed_name = "Vana Thistletop"; auto constexpr constructed_priority = 17; @@ -20,26 +20,84 @@ namespace turns::domain::tests REQUIRE(participant::create(constructed_name, constructed_priority)); } - SECTION("the name can be read") + SECTION("allows access to its name via the associated accessors") { - REQUIRE(instance.get_name() == constructed_name); + SECTION("allowing to get it") + { + REQUIRE(instance.get_name() == constructed_name); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.get_name() == constructed_name); + } + + SECTION("allowing to set it") + { + instance.set_name("replaced"); + REQUIRE(instance.get_name() == "replaced"); + } } - SECTION("the name can be changed") + SECTION("allows access to its name via the associated property") { - instance.set_name("replaced"); - REQUIRE(instance.get_name() == "replaced"); + SECTION("allowing to get it") + { + REQUIRE(instance.property_name() == constructed_name); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.property_name() == constructed_name); + } + + SECTION("allowing to set it") + { + instance.property_name() = "replaced"; + REQUIRE(instance.get_name() == "replaced"); + } } - SECTION("the priority can be read") + SECTION("allows access to its priority via the associated accessors") { - REQUIRE(instance.get_priority() == constructed_priority); + SECTION("allowing to get it") + { + REQUIRE(instance.get_priority() == constructed_priority); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.get_priority() == constructed_priority); + } + + SECTION("allowing to set it") + { + instance.set_priority(3); + REQUIRE(instance.get_priority() == 3); + } } - SECTION("the priority can be changed") + SECTION("allows access to its priority via the associated property") { - instance.set_priority(8); - REQUIRE(instance.get_priority() == 8); + SECTION("allowing to get it") + { + REQUIRE(instance.property_priority() == constructed_priority); + } + + SECTION("allowing to get it via a constant object") + { + auto const & cref = instance; + REQUIRE(cref.property_priority() == constructed_priority); + } + + SECTION("allowing to set it") + { + instance.property_priority() = 4; + REQUIRE(instance.get_priority() == 4); + } } SECTION("can be compared with another participant") |
