Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring katas practice #33

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

kumarnareshh74
Copy link

No description provided.

Added a new Inn class in Inn.cs to encapsulate the logic for updating the quality and sell-in values of items. Updated GildedRose.Console.csproj to include Inn.cs. Modified Program.cs to use the new Inn class for updating item quality, replacing the previous call to app.UpdateQuality().
Refactored the `UpdateItem` method in the `Inn` class to delegate
item update logic to a new `Update` extension method in the
`ItemExtensions` class. Added `ItemExtensions.cs` to the project
compilation in `GildedRose.Console.csproj`.
Removed ItemExtensions.cs and updated GildedRose.Console.csproj to exclude it from compilation. Moved the update logic into a new Update method within the Item class, handling specific rules for different item types directly.
Added a new `AgedBrie` class in `AgedBrie.cs` inheriting from `Item` with a custom `Update` method for "Aged Brie" items. Updated `GildedRose.Console.csproj` to include this new file. Removed special handling for "Aged Brie" from the `Item` class in `Item.cs`. Changed instantiation of "Aged Brie" items in `Program.cs` to use the new `AgedBrie` class. Updated `TestItem_AgedBrie` in `TestAssemblyTests.cs` to create an instance of the `AgedBrie` class.
… class

Refactored the `Item` class to remove specific logic for "Backstage passes to a TAFKAL80ETC concert" and introduced a new `BackstageItem` class to handle this behavior. Updated `GildedRose.Console.csproj` to include `BackstageItem.cs`. Modified `Program.cs` and `TestAssemblyTests.cs` to use the new `BackstageItem` class. This change adheres to the Open/Closed Principle by extending functionality without modifying the existing `Item` class.
Refactored the `Item` class to remove special handling for "Sulfuras, Hand of Ragnaros". Introduced a new `Sulfuras` class that inherits from `Item` and overrides the `Update` method to do nothing, reflecting its unique behavior. Updated `Program.cs` to instantiate `Sulfuras` instead of `Item` for "Sulfuras, Hand of Ragnaros". Modified `TestAssemblyTests.cs` to use `Sulfuras` in the `TestItem_Sulfuras` test.
The Sulfuras class, which represents the "Sulfuras, Hand of Ragnaros" item, has been moved from Item.cs to a new file named Sulfuras.cs. The GildedRose.Console.csproj file has been updated accordingly. The functionality of the Sulfuras class remains unchanged.
Updated `GildedRose.sln` to Visual Studio 17.10.35004.147.
Moved `AgedBrie.cs`, `BackstageItem.cs`, `Item.cs`, and `Sulfuras.cs` to `Items` directory.
Reformatted the moved files for consistency.
Updated `GildedRose.Console.csproj` to reflect new file paths.
Introduced a new protected method `DecreaseSellIn()` in `Item.cs` to encapsulate the logic for decrementing the `SellIn` property by 1. Updated the `Update` methods in `AgedBrie`, `BackstageItem`, and `Item` classes to use this new method instead of directly manipulating the `SellIn` property. This refactoring enhances code readability and maintainability by centralizing the decrement logic.
Refactored the `Update` methods in `AgedBrie.cs`, `BackstageItem.cs`, and `Item.cs` to use a new `UpdateQuality` method. This method encapsulates the logic for updating the quality of items, ensuring that quality constraints (not exceeding 50 or dropping below 0) are maintained. This change promotes code reuse and simplifies the `Update` methods by delegating the quality update logic to a separate method.
The UpdateQuality methods in AgedBrie.cs, BackstageItem.cs, and Item.cs were changed from protected to private, restricting their access to within their respective classes. Additionally, the logic was updated: AgedBrie and BackstageItem now increment Quality by 1 if it is less than 50, while Item decrements Quality by 1 if it is greater than 0.
Updated project file `GildedRose.Console.csproj` to reflect renaming of `AgedBrie.cs` to `AgedBrieItem.cs` and `Sulfuras.cs` to `SulfurasItem.cs`.

Renamed class `AgedBrie` to `AgedBrieItem` in `AgedBrieItem.cs` and updated the constructor accordingly.

Renamed class `Sulfuras` to `SulfurasItem` in `SulfurasItem.cs` and updated the constructor accordingly.

Updated `Program.cs` to use the new class names `AgedBrieItem` and `SulfurasItem`.

Updated test methods in `TestAssemblyTests.cs` to use the new class names `AgedBrieItem` and `SulfurasItem`.
Added a new ConjuredItem class that inherits from Item and overrides the Update method to decrease quality twice as fast. Updated the project file to include ConjuredItem.cs. Modified the Main method to use ConjuredItem for "Conjured Mana Cake". Added a unit test to verify ConjuredItem behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant