Skip to content

Instantly share code, notes, and snippets.

@trikitrok
trikitrok / GildedRoseTest.cs
Last active January 22, 2025 13:47 — forked from franreyes/GildedRoseTest.cs
Gilded Rose: characterization tests killing all mutants
using NUnit.Framework;
namespace Gilded_rose.Test;
public class GildRoseTest
{
private const int MinQuality = 0;
private const int MaxQuality = 50;
[Test]
@trikitrok
trikitrok / ArgentRoseStoreTest.cs
Created January 14, 2025 03:39
Legacy Argent Rose tests with no mutants alive but not covering the loop
using NUnit.Framework;
using static ArgentRose.Tests.ArgentRoseStoreForTesting;
namespace ArgentRose.Tests;
public class ArgentRoseStoreTest
{
private const int MinQuality = 0;
private const int MaxQuality = 50;
private const int SellInLastDay = 0;
@trikitrok
trikitrok / ArgentRoseStoreTest.cs
Created January 14, 2025 03:31
Legacy Argent Rose tests with 100% coverage but many mutants still alive
using NUnit.Framework;
using static ArgentRose.Tests.ArgentRoseStoreForTesting;
namespace ArgentRose.Tests;
public class ArgentRoseStoreTest
{
[Test]
public void Regular_Product_Decreases_Quality_By_Two()
{
@trikitrok
trikitrok / BannerAdChooserRefactored.cs
Created December 16, 2024 21:25
Port of example from Re-Engineering Legacy Software book
// an abstract Rule class that each of our business rules will extend.
public abstract class Rule
{
private readonly Rule nextRule;
protected Rule(Rule nextRule)
{
this.nextRule = nextRule;
}
@trikitrok
trikitrok / BannerAdChooser.cs
Created December 16, 2024 20:48
Port of example from Re-Engineering Legacy Software book
public class BannerAdChooser
{
private readonly BannerDao bannerDao = new BannerDao();
private readonly BannerCache cache = new BannerCache();
public Banner GetAd(Player player, Page page)
{
Banner banner;
bool showBanner = true;
@trikitrok
trikitrok / AlarmTest.cs
Last active December 9, 2024 15:31
No mutants surviving (legacy version)
using NUnit.Framework;
namespace KataTirePressureVariation.Test
{
public class AlarmTest
{
private const double LowestSafePressure = 17;
private const double HighestSafePressure = 21;
private const double TooLowPressure = LowestSafePressure - 1;
private const double TooHighPressure = HighestSafePressure + 1;
@trikitrok
trikitrok / ArgentRoseStoreTest.cs
Last active January 14, 2025 03:51
Legacy Argent Rose tests with no mutants alive
using NUnit.Framework;
using static ArgentRose.Tests.ArgentRoseStoreForTesting;
namespace ArgentRose.Tests;
public class ArgentRoseStoreTest
{
private const int MinQuality = 0;
private const int MaxQuality = 50;
private const int SellInLastDay = 0;
@trikitrok
trikitrok / ArgentRoseStoreTest.cs
Created December 9, 2024 11:54
Legacy Argent Rose tests with 100% coverage but some mutants still alive
using NUnit.Framework;
using static ArgentRose.Tests.ArgentRoseStoreForTesting;
namespace ArgentRose.Tests;
public class ArgentRoseStoreTest
{
private const int MinQuality = 0;
private const int MaxQuality = 50;
private const int SellInLastDay = 0;
interface Customer {
getEarnedDiscount(): number;
addToOrdersHistory(order: Order): void;
}
// Null Customer's implementation
class NotFoundCustomer implements Customer {
private DEFAULT_DISCOUNT: number = 1.0;
class Coordinates {
public x: number;
public y: number;
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
}