This repository contains a series of projects developed during the university journey. The projects primarily focus on the practical application and experimentation of theoretical concepts learned during courses.
The first project focuses on the development of a Fraction class, aimed at representing fractions and implementing operations on them. The implementation follows the "test first" approach, where tests are defined for each functionality first, and then implementation follows.
The Fraction class must meet the following requirements:
- Read-only properties for numerator and denominator.
- Constructor that initializes the object with the normalized form of the fraction.
- Implementation of arithmetic operators (+, -, *, /) in infix syntax.
ToStringmethod that returns the representation of the fraction in normalized form.Equalsmethod that checks equality between fractions.- Implicit conversion from integer to fraction.
- Explicit conversion from fraction to integer, raising an exception if the denominator is not 1.
To begin, tests are defined for the constructor, following the "test first" approach. We start with the following correct and incorrect cases to ensure proper handling of inputs and edge cases.
The second project focuses on the use of custom attributes and reflection in C#. The goal is to develop a system where methods can be annotated with custom attributes and dynamically invoked through reflection.
The project is divided into two versions: a base and an advanced one. In the base version, three projects are created in a solution:
- A console application
Executer. - A class library
MyAttributeto define a custom attributeExecuteMe. - A class library
MyLibrarywhere classes with methods annotated with[ExecuteMe]are defined.
- Define the custom attribute
ExecuteMethat can be associated with methods. - Create public classes in
MyLibrarywith public methods annotated with[ExecuteMe]. - Use reflection in
Executerto load the DLL ofMyLibraryand dynamically invoke the annotated methods.
- Optimize the reference to
MyLibraryinExecuter. - Experiment with the values and types of arguments for the
ExecuteMeannotation. - Handle errors such as the absence of the default constructor and incorrect parameters in annotated methods.
- Handle non-default constructors and optional parameters in annotated methods.
- Explore interactions between custom attributes, reflection, and parameter types.
Contributions are welcome through pull requests. For any issues or suggestions, feel free to create a new issue.