Skip to content

Instantly share code, notes, and snippets.

<?php
interface Customer {
public function getEarnedDiscount(): float;
public function addToOrdersHistory(Order $order): void;
}
// Null Customer's implementation
class NotFoundCustomer implements Customer {
public interface Customer
{
double GetEarnedDiscount();
void AddToOrdersHistory(Order order);
}
// Null Customer's implementation
public class NotFoundCustomer : Customer
{
public interface Customer {
double getEarnedDiscount();
void addToOrdersHistory(Order order);
}
// Null Customer's implementation
public class NotFoundCustomer implements Customer {
private final double DEFAULT_DISCOUNT = 1.0;
public class Coordinates {
public int x;
public int y;
public Coordinates(int x, int y) {
this.x = x;
this.y = y;
}
}
public class PageSEO {
Page calculate(Page current, Search search) {
// ...
}
}
@trikitrok
trikitrok / IndexationAndCalculator.java
Last active February 4, 2025 17:18 — forked from franreyes/IndexationAndCalculator.java
IndexationAndCalculator.java
public interface IndexationCalculator {
Page update(Page current, Search search);
}
public interface CanonicalCalculator {
Page update(Page current, Search search);
}
public class Page {
public bool isIndexed;
@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;
}