Browse files

Moving Functionality to be on Fluent Type

I call these base types FluentTypes as all of the behavior of the type moves into the base type class.
Instead of newing up an IntegerEquality, we can now call IsEqual on our subject and compare it to our expected. This allows us much smoother and simpler interaction with the types.
  • Loading branch information...
Fyzxs committed Jun 20, 2018
1 parent 73f4736 commit ab816ac7882e3b178ffa62fbb24659df5df7082d
Showing with 2 additions and 3 deletions.
  1. +2 −3 AddTwoInts/AddTwoIntsTests.cs
@@ -15,17 +15,16 @@ public void ShouldReturnSumOfTwoInts()
Integer subject = new Sum(augend, addend);

Bool integerEquality = new IntegerEquality(subject, expected);

Assert.IsTrue(subject.IsEqual(expected), $"Actual <{(int)subject}> was not the same as Expected <{(int)expected}>");

public abstract class Integer
public static implicit operator int(Integer origin) => origin.Value();
protected abstract int Value();
public Bool IsEqual(Integer other) => new IntegerEquality(this, other);

public sealed class IntegerOf : Integer

0 comments on commit ab816ac

Please sign in to comment.