# Character copier

## Overview

The character copier is a simple class that reads characters from a source and copies them to a destination one character at a time.

When the Copy() method is called on the copier, it should read characters from the source and copy them to the destination until the source returns a newline (‘\n’). Implement the character copier using test doubles for the source and the destination as follows.&#x20;

Start from these definitions:

{% code title="Copier.cs" %}

```csharp
public class Copier
{
	public Copier(ISource source, IDestination destination) {}
	public void Copy() {}
}
```

{% endcode %}

{% code title="ISource.cs" %}

```csharp
public interface ISource
{
	char GetChar();
}
```

{% endcode %}

{% code title="IDestination.cs" %}

```csharp
public interface IDestination
{
	void SetChar(char character);
}
```

{% endcode %}

## **Objectives**

1. Write a stub for source and a spy for destination in your test project.&#x20;
2. Repeat the kata but use a mocking framework to create mocks for source and destination.

{% hint style="success" %}
What differences did you find between the two approaches? \
Which is simpler? \
What are the pros and cons of each approach?
{% endhint %}

## Examples

Source characters: `"abc\n"` (string) or `{'a', 'b', 'c', '\n'}` (array of char)

`Copier.Copy();`

Destination characters: `"abc"` (string) or `{'a', 'b', 'c'}` (array of char)
