Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simeonsavov/programmingfundamentals_unittesting
https://github.com/simeonsavov/programmingfundamentals_unittesting
arrays-lists csharp exercises for-loops methods nested-loops nunit-tests programming-language unit-testing unittesting while-loop-csharp
Last synced: about 18 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/simeonsavov/programmingfundamentals_unittesting
- Owner: SimeonSavov
- Created: 2023-09-30T06:09:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-05T15:07:10.000Z (about 1 year ago)
- Last Synced: 2023-11-06T15:37:21.423Z (about 1 year ago)
- Topics: arrays-lists, csharp, exercises, for-loops, methods, nested-loops, nunit-tests, programming-language, unit-testing, unittesting, while-loop-csharp
- Language: C#
- Homepage:
- Size: 3.11 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Programming Fundamentals and Unit Testing with C#
Welcome to my repository for the 'Programming Fundamentals and Unit Testing' course in QA Engineering at SoftUni. Here, I will be sharing my exercises and projects.
## Folder Structure
- [ConditionalStatements_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-first-section---conditional-statements-lesson-1)
- [ComplexConditionalStatements](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-second-section---complex-conditional-statements-lesson-2)
- [AdvancedConditonalStatemens](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-third-section---advanced-conditional-statements-lesson-3)
- [ForLoops_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-fourth-section---for-loops-lesson-4)
- [WhileLoop_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-fifth-section---while-loops-lesson-5)
- [ForAndWhileLoops](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-sixth-section---for-and-while-loops-lesson-6)
- [NestedLoops_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-seventh-section---nested-loops-lesson-7)
- [Methods_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-eighth-section---methods-lesson-8)
- [NestedLoopsAndMethods_Exercises](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-ninth-section---nested-loops-and-methods-lesson-9)
- [Arrays_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-tenth-section---arrays-lesson-10)
- [Lists_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-eleventh-section---lists-lesson-11)
- [ArraysAndLists_Exercises](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-twelfth-section---arrays-and-lists-lesson-12)
- [UnitTestingMethods_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-thirteenth-section---unit-testing-methods-lesson-13)
- [UnitTestingArraysLists_Lab](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-fourteenth-section---unit-testing-arrays-and-lists-lesson-14)
- [UnitTestingMethodsArraysAndLists_Exercises](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#about-the-fifteenth-section---unit-testing-methods-arrays-and-lists-lesson-15)
- [ExamPreparation_1](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#exam-preparation-1---c-methods-and-unit-testing)
- [ExamPreparation_2](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#exam-preparation-2---c-logical-and-unit-testing)
- [ExamPreparation_3](https://github.com/SimeonSavov/ProgrammingFundamentals_UnitTesting#exam-preparation-3---c-logical-tasks-and-unit-testing)## About the First Section - Conditional Statements (Lesson 1)
In the first section of this course, I delved into the essential concepts of conditional statements in C#. Here's a summary of what I've learned and practiced:
1. **Basic If-Else Statements:** I grasped the usage of the `if` statement to create conditional logic in my programs. This allowed me to make decisions based on conditions, and I honed my skills in using `else` to handle alternative outcomes.
2. **Switch-Case Statements:** I explored the efficiency of the `switch-case` statement, which streamlined handling multiple conditional branches based on the value of an expression.
3. **Comparison and Logical Operators:** I refreshed my understanding of various comparison operators (e.g., `==`, `>`, `<`) and logical operators (e.g., `&&`, `||`) to construct complex conditional expressions.
4. **Nested Conditional Statements:** I practiced using nested `if-else` statements to manage multiple levels of conditions, empowering me to create more sophisticated logic.
5. **Validation and Error Handling:** I mastered the art of incorporating validation checks into my programs to ensure that user inputs are valid. I also learned how to display meaningful error messages when necessary.
6. **Calculations and Output:** I applied conditional statements to perform calculations and generate output messages based on specific conditions.
## About the Second Section - Complex Conditional Statements (Lesson 2)
In the second section of this course, I advanced my understanding of conditional statements in C# by exploring more complex scenarios and tasks. Here's an overview of what I've covered:
1. **Multi-Branch Logic:** I delved deeper into creating multi-branch logic using `if-else if-else` statements. This allowed me to handle a variety of conditions and outcomes within a single block of code.
2. **Nested Conditional Statements:** Building upon the concepts from the first section, I practiced using nested conditional statements to handle intricate decision-making processes. This enabled me to address more complex tasks effectively.
3. **String Comparison:** I learned how to compare strings using conditional statements, allowing me to take specific actions based on user input or string values.
4. **Numeric Comparisons:** I expanded my knowledge of numeric comparisons and utilized them to implement various mathematical operations and calculations within my programs.
5. **Advanced Validation:** I honed my skills in incorporating advanced validation checks to ensure that user inputs meet specific criteria, enhancing the robustness of my applications.
6. **Enhanced Output:** I applied complex conditional logic to generate detailed and context-aware output messages, improving the user experience and clarity of program responses.
## About the Third Section - Advanced Conditional Statements (Lesson 3)
In the third section of this course, I further expanded my knowledge of conditional statements in C#, delving into more advanced and intricate scenarios. Here's an overview of what I've covered:
1. **Conditional Logic Mastery:** I continued to refine my skills in crafting sophisticated conditional logic using `if-else if-else` statements. This allowed me to handle complex decision-making processes with ease.
2. **Nested Conditional Statements:** I built upon my understanding of nested conditional statements, enabling me to manage intricate, multi-level conditions effectively.
3. **String Manipulation:** I learned how to manipulate strings using conditional statements, giving me the ability to create dynamic and context-aware output messages.
4. **Numeric Precision:** I deepened my knowledge of numeric comparisons and precision, which was crucial for implementing various mathematical operations and calculations in my programs.
5. **Validation Strategies:** I explored advanced validation strategies, ensuring that my programs handle a wide range of user inputs gracefully and securely.
6. **Enhanced User Experience:** I applied complex conditional logic to generate highly customized output messages, elevating the user experience and providing clear and context-sensitive program responses.
## About the Fourth Section - For Loops (Lesson 4)
In the fourth section of this course, I delved into the powerful world of `for` loops in C#. Here's an overview of what I've covered:
1. **Number Range Iteration:** I learned how to use a `for` loop to iterate through a range of numbers effectively. This provided a foundation for various numerical applications.
2. **Number Sum Calculation:** I developed programs to calculate the sum of numbers within specific ranges. This improved my understanding of arithmetic operations and loop structures.
3. **Countdown Timers:** I created countdown timer programs, such as an exam countdown. These programs involved user input, enhancing my input handling skills.
4. **Character Sequences:** I practiced generating and displaying character sequences within user-defined ranges. This improved my ability to work with character data.
5. **Output Customization:** I used `for` loops to generate customized output messages, improving user experience by providing dynamic and context-sensitive responses.
## About the Fifth Section - While Loops (Lesson 5)
In the fifth lesson of this course, I explored the versatility of `while` loops in C# programming. Here's an overview of what I've covered:
1. **Countdown with a While Loop:** I created a program that counts down from a user-provided integer using a `while` loop. The program continuously prompts the user for input and displays the countdown until reaching 1.
2. **Validation Loop:** I developed a program that ensures user input falls within a specified range. It repeatedly prompts for input until a valid number within the range is provided.
3. **Pattern-Based Number Generation:** I crafted a program that generates a sequence of numbers based on a specific pattern using a `while` loop. The user specifies an upper limit, and the program generates numbers following the pattern until reaching or exceeding the limit.
4. **Sum of Digits:** I designed a program that calculates the sum of the digits of a positive integer. The program uses a `while` loop to iteratively extract and sum each digit.
5. **Interactive Numeric Manipulation:** I created a program that allows users to manipulate a numeric value using custom commands ("Inc" and "Dec"). The program continues to process commands until the user inputs "End," at which point it displays the final manipulated value.
## About the Sixth Section - For and While Loops (Lesson 6)
In the sixth lesson of this course, I explored the capabilities of both `for` and `while` loops in C# programming. This lesson allowed me to gain a deeper understanding of iterative control structures. Below is a summary of the tasks I completed and the key concepts I've learned:
1. **Power Calculation with a For Loop:** I used a `for` loop to calculate the result of raising a given number to a certain power. I provided the base number and exponent, and the program computed and displayed the result. This task emphasized the repetitive nature of `for` loops for mathematical computations.
2. **Multiplication Table with a For Loop:** I utilized a `for` loop to generate a multiplication table for a user-provided number from 1 to 10. The program calculated and displayed the products for each factor in the table. This task illustrated how `for` loops can efficiently handle repetitive patterns.
3. **Percentage Calculation with a For Loop:** I employed a `for` loop to calculate the percentage of numbers divisible by 2, 3, and 4 within a set of user-input numbers. The program computed and displayed the percentages for each divisibility criterion, highlighting the utility of `for` loops in data analysis.
4. **Checking Special Numbers with a While Loop:** I used a `while` loop to check if a user-input number is "special," meaning it is divisible by all of its individual digits. The task demonstrated the flexibility of `while` loops in handling iterative processes that may not have a fixed number of iterations.
5. **Price Increase on Stop Number with a While Loop:** I employed a `while` loop to continuously read numbers from the user until a specified stop number was encountered. Once the stop number was found, the program calculated and displayed a 20% price increase over the previous number. This task highlighted the interactive and dynamic nature of `while` loops.
### Key Concepts Learned:
- **For Loops:** I learned that `for` loops are particularly useful for situations where the number of iterations is known in advance, such as iterating over a range of numbers or performing a fixed number of operations.
- **While Loops:** I discovered that `while` loops are versatile for scenarios where the number of iterations may vary based on user input or dynamic conditions. They allow for interactive and adaptive control flow.
- **Mathematical Computations:** I applied loops for mathematical calculations, including exponentiation, multiplication tables, and percentage calculations.
- **Data Analysis:** I used loops to analyze data by counting and calculating percentages based on specific criteria.
These tasks collectively provided me with a solid foundation in using `for` and `while` loops for a wide range of programming challenges.
## About the Seventh Section - Nested Loops (Lesson 7)
In the seventh lesson of this course, I explored nested loops in C# and gained valuable insights into their practical applications. Here are the main takeaways:
1. **Efficient Counting and Sequences:** I harnessed the power of `for` loops to efficiently count down, calculate powers, and generate numerical sequences.
2. **Pattern Creation:** Nested loops allowed me to create intricate visual patterns, including star triangles, numerical pyramids, and labeled building structures.
3. **Interactive Savings Tracking:** I used nested `while` loops to interactively track savings for multiple travel destinations, enhancing user interaction.
4. **Digit Manipulation:** I employed nested loops to calculate the sum of digits and check for special numbers, showcasing the versatility of loops in processing numerical data.
5. **Prime Number Identification:** By combining loops with conditional statements, I efficiently identified prime numbers within specified ranges, demonstrating the practicality of nested loops in number analysis.
This lesson expanded my understanding of nested loops, enabling me to handle diverse programming challenges and create structured patterns with ease.
## About the Eighth Section - Methods (Lesson 8)
In the eighth lesson of this course, I explore the power of methods in C# programming, allowing me to streamline and simplify various calculations. Here's an overview of the key takeaways from the tasks:
1. **Sign of Numbers:** I develop a method, `PrintNumberSign`, which efficiently determines whether a number is positive, negative, or zero, and displays the result to the user. This method simplifies the process of evaluating number signs.
2. **Grading in Words:** I create the `GradeInWords` method to translate numerical grades into descriptive terms such as "Fail," "Average," "Good," "Very good," and "Excellent." This method enhances user communication and provides clear grade interpretation.
3. **Pattern Printing:** I introduce the `PrintTriangle` method to generate visually pleasing patterns using nested loops. This method facilitates the creation of symmetrical and structured output patterns.
4. **Area Calculation:** I implement the `CalculateRectArea` method for the efficient calculation of the area of a rectangle. This method encapsulates the area calculation logic and improves code modularity.
5. **String Repetition:** I develop the `RepeatString` method, which repetitively concatenates a string a specified number of times. This method simplifies string repetition tasks and ensures code clarity.
6. **Exponentiation:** I utilize the `MathPower` method to efficiently calculate the result of raising a base number to a specified power. This method simplifies mathematical exponentiation and enhances code reusability.
7. **Comparing Values:** I introduce methods like `FindGreaterNumber`, `FindGreaterChar`, and `FindGreaterString` to compare values of different data types (int, char, and string) and determine the greater one. These methods enhance my ability to compare and identify the largest value among different types.
8. **Product Pricing:** I create the `CalculatePrice` method to determine the total price of a product based on its name and quantity. This method simplifies product pricing logic and promotes code organization.
9. **Absolute Value and Multiplication:** In the final task, I introduce a method, `GetMultipleOfEvenAndOdds`, which calculates the product of the sums of even and odd digits in an integer. This method facilitates the calculation of products based on digit parity and absolute value.This lesson equips me with a versatile toolkit of methods to tackle various programming challenges, ensuring efficiency, organization, and clear communication in my code.
## About the Ninth Section - Nested Loops and Methods (Lesson 9)
In the ninth lesson of this course, I dive into the realm of nested loops and methods, honing my problem-solving skills with a combination of structured patterns, numerical manipulations, and custom methods. Below are the key highlights from the exercises:
1. **Complex Number Patterns:** I explore intricate nested loop patterns to generate combinations of even and odd numbers, enhancing my pattern recognition and nested loop capabilities.
2. **Number Combinations:** I delve into nested loops to find and display combinations of three digits that multiply to a given number, sharpening my analytical and computational skills.
3. **Prime Numbers in a Grid:** I utilize nested loops to find prime numbers within a given grid, improving my understanding of nested loops and prime number identification.
4. **Character Combinations:** I take on a challenge of generating character combinations while excluding a specific character, showcasing my loop and conditional statement prowess.
5. **Numeric Puzzles:** I engage in solving numeric puzzles involving combinations of digits to match a given sum, demonstrating my ability to tackle numerical challenges effectively.
6. **Counting Vowels:** I create a method, `GetCountVowels`, to count the vowels in a given text, enhancing my skills in character manipulation and method development.
7. **Factorial Calculations:** I implement a method for calculating factorials, showcasing my ability to work with mathematical operations and custom methods.
8. **Number Sign Determination:** I create a method, `PrintSign`, to evaluate and print the sign of three numbers, demonstrating my proficiency in method design and conditional statements.
9. **Password Validation:** I construct a password validation system with custom methods to assess password length, content, and digit count, emphasizing my capability to design and implement robust methods.
This lesson combines the power of nested loops and custom methods, empowering me to tackle diverse programming challenges, from pattern generation to advanced problem-solving and validation tasks. My skills are now well-rounded and ready for more complex coding endeavors.
## About the Tenth Section - Arrays (Lesson 10)
In the tenth lesson of this course, I venture into the world of arrays in C# programming, where I acquire skills to work with collections of data efficiently. Here are the key takeaways from the provided exercises:
1. **Day of the Week:** I begin by creating a simple array to associate numbers with days of the week, allowing me to quickly look up and display the corresponding day for a given number.
2. **Array Sum:** I dive into basic array operations, learning how to sum up the elements of an array and gain a better grasp of working with data collections.
3. **Reverse Array:** I explore array manipulation by reversing an array's elements, deepening my understanding of array indexing and data reordering.
4. **Odd and Even Sums:** I tackle the task of finding the difference between the sums of even and odd numbers within an array, honing my skills in conditional statements and arithmetic operations.
5. **Identical Arrays:** I practice array comparison, determining if two arrays contain the same elements in the same order, showcasing my ability to work with and compare data collections.
6. **Common Elements:** I take on the challenge of finding common elements between two arrays, emphasizing my skills in array intersection and efficient data processing.
With this lesson, I've equipped myself with the fundamental knowledge and techniques to effectively work with arrays, a crucial data structure in programming, laying the foundation for more advanced data manipulation and processing tasks.
## About the Eleventh Section - Lists (Lesson 11)
In the eleventh lesson of this course, I delved into the world of lists in C#, expanding my knowledge and capabilities in working with data collections. Here's an overview of the key insights gained from the provided exercises:
1. **List Manipulation:** I learned to create and manipulate lists by reading user input and performing insertions or deletions based on specific commands. This exercise sharpened my list handling skills.
2. **Alphabetical List:** I tackled the task of sorting a list of strings in alphabetical order and displaying the results. This exercise improved my understanding of list sorting and management.
3. **Positive Integers:** I filtered and reversed a list of integers, removing negative numbers and reversing the remaining elements. This task enhanced my list filtering and reversal abilities.
4. **Dynamic List Operations:** I developed a program that reads a list of integers and processes a variety of user commands, such as adding, removing, checking for containment, and applying filters. This exercise broadened my capabilities in dynamic list operations.
With these exercises, I've expanded my proficiency in working with lists, a versatile data structure in C#. These skills will prove invaluable in handling and processing various data collections in more complex programming tasks.
## About the Twelfth Section - Arrays and Lists (Lesson 12)
In the twelfth lesson of this course, I delved into a series of exercises that expanded my knowledge and skills in working with arrays and lists in C#. These exercises challenged me to manipulate data collections efficiently and apply various techniques to solve complex programming problems. Here's a glimpse of what I accomplished in this section:
1. **List Pair Sums:** I developed a solution to calculate pair sums from a list of integers, providing valuable practice in list manipulation and mathematical operations.
2. **Recursive List Sum:** I tackled a recursive approach to calculate the sum of a list of integers, improving my understanding of recursion and list processing.
3. **Concatenation and Merge:** I mastered the art of merging and concatenating two lists, enhancing my skills in list management and data combination.
4. **Element Aggregation:** I created a program to process a list of integers, focusing on aggregating elements by identifying repeating sequences, refining my problem-solving and list manipulation abilities.
5. **Bomb Numbers:** I designed a solution to simulate the detonation of "bomb" numbers within a list, calculating the remaining sum after the detonation. This exercise improved my skills in conditional logic and list modifications.
6. **Number Wars:** I implemented a game of "Number Wars" involving two players and their lists of integers. The game's logic involved comparing and transferring cards between players, and determining the winner based on the final sum. This exercise offered valuable experience in game logic and list handling.
7. **Even-Odd Rows:** I created a program to read a matrix of integers row by row, separating even and odd rows into distinct lists. This exercise strengthened my matrix processing capabilities and list organization skills.
8. **Array Rotation:** I solved the problem of rotating an array by a specified number of positions, expanding my knowledge of array operations and data manipulation.
9. **Longest Subsequence:** I developed a solution to find the longest subsequence of consecutive equal elements in a list of integers, emphasizing my skills in sequence identification and list processing.
10. **Top Integers:** I crafted a program to identify and extract "top integers" from a list, further enhancing my abilities in list traversal and conditional checking.
These exercises have equipped me with an extensive toolkit for handling arrays and lists, reinforcing my understanding of data structures and data manipulation techniques in C#. I'm now well-prepared for more advanced programming challenges and projects.
## About the Thirteenth Section - Unit Testing Methods (Lesson 13)
In the thirteenth lesson of this course, I ventured into the realm of unit testing methods in C#, a fundamental practice that ensures the reliability and correctness of my code. This section consisted of implementing and testing various methods, challenging me to validate their functionality and handle edge cases effectively. Here's an overview of what I accomplished in this section:
1. **Mathematical Operations:** I explored unit testing by implementing and testing methods for addition and subtraction. These basic operations laid the foundation for understanding unit testing concepts.
2. **Factorial Calculator:** I built and tested a method for calculating factorials, learning how to handle both typical and edge cases while ensuring that the method adhered to its specifications.
3. **Grading System:** I practiced unit testing by creating and testing a method that converts numerical grades into descriptive words. This exercise reinforced my understanding of test cases and expected outcomes.
4. **String Manipulation:** I dived into testing string manipulation methods, focusing on reversing strings. I learned how to construct test cases and verify the correctness of the reversed strings.
5. **Triangle Printing:** I ventured into unit testing for methods that involve complex logic. I implemented and tested a method for printing triangles of different sizes, refining my skills in designing test cases and ensuring the desired output.
These exercises equipped me with the essential knowledge and practical experience in unit testing methods, a crucial aspect of maintaining code quality and reliability. I'm now well-prepared to implement robust unit tests for my future coding projects and ensure the accuracy and functionality of my code.
## About the Fourteenth Section - Unit Testing Arrays and Lists (Lesson 14)
In the fourteenth lesson of this course, I delved into the vital practice of unit testing, focusing on arrays and lists in C#. This section revolved around creating and testing methods to validate their functionality and correctness, especially when handling different types of collections. Here's an overview of what I achieved in this section:
1. **Adjacent Equal Number Sum:** I implemented and rigorously tested a method that efficiently sums adjacent equal numbers in a list, ensuring the reliability of this operation.
2. **Array Average Calculator:** I crafted and tested a method for calculating the average of an array, emphasizing the importance of handling edge cases and ensuring the method's accuracy.
3. **Even-Odd Subtraction:** I ventured into unit testing by developing and testing a method that calculates the absolute difference between the sums of even and odd numbers in an array, sharpening my testing skills for diverse scenarios.
4. **Gauss Trick:** I explored testing for list manipulation methods, specifically a Gauss trick for summing pairs of list elements. This exercise solidified my understanding of testing different list structures and element sums.
5. **Maximum Number Finder:** I created a method and performed comprehensive testing for finding the maximum number in a list, addressing various scenarios and ensuring the method's reliability.
6. **Array Reversal:** I wrapped up the section by developing a method and conducting tests to reverse the order of elements in an array, reinforcing my expertise in verifying expected outcomes.
These exercises have equipped me with a strong foundation in unit testing, particularly for arrays and lists. I can now confidently validate the functionality and accuracy of methods that work with collections, ensuring the reliability of my code in real-world applications.
## About the Fifteenth Section - Unit Testing Methods, Arrays and Lists (Lesson 15)
In the fifteenth lesson of this course, I continued to strengthen my unit testing skills, focusing on methods that involve arrays and lists in C#. This section was instrumental in furthering my understanding of how to develop and test methods that operate on collections, ensuring their accuracy and reliability. Here's an overview of the key topics covered in this section:
1. **Duplicates Detection and Removal:** I created and extensively tested a method for identifying and removing duplicate elements from an integer array. The thorough testing ensured that the method functions as expected in various scenarios.
2. **Email Validation:** I tackled email validation, developing a method to check the validity of email addresses. Robust unit testing was performed to confirm that the method correctly identifies both valid and invalid email addresses.
3. **Filtering Digits from Strings:** I ventured into unit testing by creating a method to filter numeric digits from a character array. Testing involved various cases, including null input and arrays with mixed characters and digits.
4. **Fibonacci Number Calculation:** I developed and tested a method to calculate Fibonacci numbers, addressing negative inputs and verifying that the method produces accurate results for both small and large Fibonacci numbers.
5. **Matrix Addition:** I delved into the realm of matrices, creating a method for adding two matrices. The tests covered a range of scenarios, including empty matrices, matrices with differing dimensions, and matrices with negative and positive values.
6. **Number Processing:** I explored methods for processing numbers, particularly integers. I implemented tests to validate the handling of even and odd numbers, zero, negative numbers, and empty input arrays.
7. **Palindrome Detection:** I created a method to detect palindromes in lists of words. The tests evaluated the method's ability to correctly identify palindromes while accommodating various word lengths and cases.
8. **Sorting in a Pattern:** I developed a method to sort an array in a specific pattern, alternating between ascending and descending order. The unit tests confirmed the method's ability to correctly sort arrays of distinct integers.
9. **Largest Prime Factor:** I created a method for finding the largest prime factor of a number. The unit tests covered cases involving negative numbers, prime numbers, and large numbers.
10. **String Reversal:** Finally, I implemented and tested a method to reverse an array of strings. The tests included empty arrays, single-string reversals, and handling special characters within strings.
This section not only reinforced my unit testing skills but also broadened my understanding of creating robust methods for working with arrays and lists. I can now confidently develop and test methods that manipulate and process collections, ensuring the correctness and reliability of my code.
## Exam Preparation 1 - C# Methods and Unit Testing
In this section, I have undertaken an exam preparation with a series of four tasks to assess my proficiency in C# programming and unit testing. Each task addresses different coding challenges and is complemented by rigorous unit tests to ensure the accuracy and reliability of my code.
**Task 1 - Factorial Sum**
The first task involves the calculation of the sum of factorials for even digits within an input number. I've implemented an efficient method for factorial calculations and applied it to sum factorials of even digits from the input number. A comprehensive set of unit tests validates the correctness of this mathematical operation.**Task 2 - Middle Array Average**
Task two requires calculating the average of values within the middle of an integer array. My code identifies the middle elements and computes their average. Extensive unit tests cover various scenarios and edge cases to verify the accuracy of the results.**Task 3 - Closest Point**
The third task challenges me to determine the closest point in a two-dimensional space based on their absolute distances. I've created a method for calculating and returning the closest point. A comprehensive suite of unit tests ensures the method's correctness across different proximity scenarios.**Task 4 - Fold Array Sum**
The fourth task focuses on array manipulation by folding and summing elements from the top and bottom halves. I've developed the `FoldArray` method to perform this operation and created unit tests to validate its accuracy. The tests encompass arrays of varying lengths, negative numbers, empty arrays, and a range of folding scenarios.This exam preparation section serves as a comprehensive assessment of my C# programming skills, including method development, mathematical operations, and proficiency in unit testing. The tasks cover a wide spectrum of coding challenges, allowing me to showcase my ability to write efficient and reliable code, rigorously tested for correctness.
## Exam Preparation 2 - C# Logical and Unit Testing
In this Exam Preparation 2, I've encountered four diverse tasks that evaluate my proficiency in C# programming and unit testing. Each task presents a unique coding challenge, and I've ensured the correctness and reliability of my code through thorough unit testing.
**Task 1 - Prime Sum**
The first task revolves around identifying and summing prime digits within a given number. I've developed a method that efficiently checks for prime digits and sums them if they meet specific criteria. Comprehensive unit tests cover various scenarios to confirm the method's accuracy.**Task 2 - Selection Statistics**
In task two, I tackle the challenge of finding the maximum and minimum values within a portion of an array. My solution efficiently computes these statistics based on user-defined selection. Extensive unit tests encompass a range of selection sizes, ensuring the correct identification of max and min values.**Task 3 - Pascal's Triangle**
Task three is an exploration of Pascal's Triangle, requiring the generation of its first 'n' rows. I've crafted a method that accurately constructs the triangle's rows and verified it through unit tests, covering cases like zero rows, negative input, and various row counts.**Task 4 - Longest Increasing Subsequence**
The fourth task delves into dynamic programming to find the Longest Increasing Subsequence (LIS) of an integer array. My code efficiently computes the LIS and returns it as a string. Comprehensive unit tests validate the method's accuracy, considering scenarios like null arrays, empty arrays, and both sorted and unsorted arrays.This exam preparation section showcases my versatility in addressing coding challenges and emphasizes the importance of thorough unit testing in ensuring the reliability and correctness of my C# code.
## Exam Preparation 3 - C# Logical Tasks and Unit Testing
In Exam Preparation 3, I tackled four unique coding challenges that put my C# programming skills to the test while emphasizing the importance of unit testing in ensuring the accuracy and reliability of my code.
**Task 1 - Digit to Word Converter**
The first task involved transforming each digit in a given number into its corresponding word representation. I developed a solution using a `switch` statement to map digits to words. This task underscored the need for meticulous handling of each digit to produce the correct word representation, a correctness that was rigorously verified through unit tests.
**Task 2 - Array Selection Average**
Task two required calculating the average of selected elements in an integer array. My code efficiently identified the specified selection, computed the average, and presented the result with precision. The unit tests rigorously assessed the code across various selection sizes, ensuring the accurate determination of maximum and minimum values.
**Task 3 - File Path Analyzer**
The third task delved into the parsing of file paths to extract file names and extensions. I introduced the `ExtractFile` class, which adeptly managed different path scenarios, including paths without extensions. The unit tests comprehensively scrutinized the class's behavior, cementing its robustness and correctness.
**Task 4 - Drum Hit Simulation**
The fourth task simulated drum hits and calculated the quality of drums and the remaining balance. My `DrumSet` class skillfully processed the commands, adjusting drum quality, and deducting money for repairs or replacements as required. The unit tests encompassed various scenarios, including handling invalid commands and managing insufficient balance, ensuring the program's dependability.
This section of the exam preparation celebrated my diverse C# programming abilities, revealing my proficiency in tackling an array of coding challenges. The focus on unit testing highlighted the pivotal role of precision and reliability in C# code, a pivotal aspect of my programming journey.