diff --git a/src/StatePattern/FanExample/FanMotivationalExample.cs b/src/StatePattern/FanExample/FanMotivationalExample.cs
new file mode 100644
index 0000000..72dd9bd
--- /dev/null
+++ b/src/StatePattern/FanExample/FanMotivationalExample.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace StatePattern.FanExample
+{
+ public class FanMotivationalExample
+ {
+ public static void Run()
+ {
+ FanMotivationalContext fanContext = new FanMotivationalContext();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ }
+ }
+
+ public class FanMotivationalContext
+ {
+ private const int OFF = 0;
+
+ private const int S1 = 1;
+
+ private const int S2 = 2;
+
+ private const int S3 = 3;
+
+ private const int S4 = 4;
+
+ int state = OFF;
+
+ public void PullChain()
+ {
+ if(state == OFF)
+ {
+ Console.WriteLine("Turning TV to speed 1");
+ state = S1;
+ }
+ else if(state == S1)
+ {
+ Console.WriteLine("Turning TV to speed 2");
+ state = S2;
+ }
+ else if (state == S2)
+ {
+ Console.WriteLine("Turning TV to speed 3");
+ state = S3;
+ }
+ else if (state == S3)
+ {
+ Console.WriteLine("Turning TV to speed 4");
+ state = S4;
+ }
+ else if (state == S4)
+ {
+ Console.WriteLine("Turning TV OFF");
+ state = OFF;
+ }
+ }
+
+ }
+}
diff --git a/src/StatePattern/FanExample/FanWithStatePatternExample.cs b/src/StatePattern/FanExample/FanWithStatePatternExample.cs
new file mode 100644
index 0000000..69a1a22
--- /dev/null
+++ b/src/StatePattern/FanExample/FanWithStatePatternExample.cs
@@ -0,0 +1,165 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace StatePattern.FanExample
+{
+ public class FanWithStatePatternExample
+ {
+ public static void Run()
+ {
+ FanMotivationalContext fanContext = new FanMotivationalContext();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+
+ fanContext.PullChain();
+ }
+ }
+
+ ///
+ /// Context
+ ///
+ public class FanContext
+ {
+ public IFanState OFF { get; private set; }
+
+ public IFanState S1 { get; private set; }
+
+ public IFanState S2 { get; private set; }
+
+ public IFanState S3 { get; private set; }
+
+ public IFanState S4 { get; private set; }
+
+ public IFanState State { get; set; }
+
+ public FanContext()
+ {
+ OFF = new FanOffState(this);
+
+ S1 = new FanS1State(this);
+
+ S2 = new FanS2State(this);
+
+ S3 = new FanS3State(this);
+
+ S4 = new FanS4State(this);
+
+ State = OFF;
+ }
+
+ public void PullChain()
+ {
+ State.PullChain();
+ }
+ }
+
+ ///
+ /// State interface
+ ///
+ public interface IFanState
+ {
+ void PullChain();
+ }
+
+ public class FanOffState : IFanState
+ {
+ FanContext context;
+ public FanOffState(FanContext context)
+ {
+ this.context = context;
+ }
+ public void PullChain()
+ {
+ Console.WriteLine("Turning TV to speed 1");
+ context.State = context.S1;
+ }
+ }
+
+ ///
+ /// State concrete implementation
+ ///
+ public class FanS1State : IFanState
+ {
+ private FanContext fanContext;
+
+ public FanS1State(FanContext fanContext)
+ {
+ this.fanContext = fanContext;
+ }
+
+ public void PullChain()
+ {
+ Console.WriteLine("Turning TV to speed 2");
+ fanContext.State = fanContext.S2;
+ }
+ }
+
+ ///
+ /// State concrete implementation
+ ///
+ public class FanS2State : IFanState
+ {
+ private FanContext fanContext;
+
+ public FanS2State(FanContext fanContext)
+ {
+ this.fanContext = fanContext;
+ }
+
+ public void PullChain()
+ {
+ Console.WriteLine("Turning TV to speed 3");
+ fanContext.State = fanContext.S3;
+ }
+ }
+
+ ///
+ /// State concrete implementation
+ ///
+ public class FanS3State : IFanState
+ {
+ private FanContext fanContext;
+
+ public FanS3State(FanContext fanContext)
+ {
+ this.fanContext = fanContext;
+ }
+
+ public void PullChain()
+ {
+ Console.WriteLine("Turning TV to speed 4");
+ fanContext.State = fanContext.S4;
+ }
+ }
+
+ ///
+ /// State concrete implementation
+ ///
+ public class FanS4State : IFanState
+ {
+ private FanContext fanContext;
+
+ public FanS4State(FanContext fanContext)
+ {
+ this.fanContext = fanContext;
+ }
+
+ public void PullChain()
+ {
+ Console.WriteLine("Turning TV OFF");
+ fanContext.State = fanContext.OFF;
+ }
+ }
+}
diff --git a/src/StatePattern/StatePatternExamples.cs b/src/StatePattern/StatePatternExamples.cs
index ebee6fb..8ffa4a0 100644
--- a/src/StatePattern/StatePatternExamples.cs
+++ b/src/StatePattern/StatePatternExamples.cs
@@ -1,4 +1,5 @@
-using StatePattern.TVExample;
+using StatePattern.FanExample;
+using StatePattern.TVExample;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -15,6 +16,14 @@ namespace StatePattern
GoToNextStep();
TVExampleRunner.Run();
+
+ GoToNextStep();
+
+ FanMotivationalExample.Run();
+
+ GoToNextStep();
+
+ FanWithStatePatternExample.Run();
}
private static void GoToNextStep()