#include #include #include "Property_Test_Types.hpp" TEST(property_builder_test, builds_independent_product) { auto product = Property_Direct_Builder{7} .set<&Property_Direct_Properties::value>(42) .build(); EXPECT_EQ(product->value, 42); EXPECT_EQ(product->id, 7); } TEST(property_builder_test, configures_properties) { auto product = Property_Direct_Builder{1} .set<&Property_Direct_Properties::value>(10) .configure([](Property_Direct_Properties& properties) { properties.value += 5; }) .build(); EXPECT_EQ(product->value, 15); } TEST(property_builder_test, supports_external_validator) { auto builder = Property_External_Product::Builder{}.set<&Property_External_Properties::minimum>(10).set<&Property_External_Properties::maximum>(5); EXPECT_THROW(builder.build(), std::invalid_argument); } TEST(property_builder_test, builds_unique_product) { auto product = Property_Direct_Builder{3} .set<&Property_Direct_Properties::value>(12) .build_unique(); static_assert(std::same_as>); EXPECT_EQ(product->value, 12); EXPECT_EQ(product->id, 3); }