Last week, I was fully focused on testing the Create Command functionality of an entity. Along the way, I gained a deeper understanding of the importance of unit testing. Creating unit tests allowed me to explore different scenarios and cover as many possibilities as possible with the guidance of Mr. Peter.
In the initial test, I ensured that an entity could be created successfully even without providing any contact details. The accuracy of saving the entity information in the database was verified, along with confirming the receipt of the expected response. Building on that, the next test included a phone contact. I validated that the entity and contact details were accurately saved and associated with each other.
Moreover, with Mr. Peter’s expert guidance, I took on the challenge of creating an entity with multiple entity contacts, then specifically designating one of them as the phone contact. His insights helped me navigate the complexities involved in ensuring the proper association of the chosen contact with the entity and the flawless storage of all entity contacts in the database. Throughout these tests, to validate the expected behavior of the test methods, I used the FluentAssertions library, making assertions with confidence.
Overall, this tests successfully validated the entity creation and contact management functionalities. These tests covered a range of scenarios, including entities without contacts, entities with phone contacts, entities with multiple contacts, and entities with fax contacts. The results obtained from these tests provide a solid foundation for maintaining the integrity of the entity-related features within the application.
