Created
March 8, 2018 07:40
-
-
Save aloisdeniel/a1debbc944223082afb8ee68cf136539 to your computer and use it in GitHub Desktop.
Caboodle mock example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Microsoft.Caboodle | |
{ | |
public interface IBattery | |
{ | |
void StartBatteryListeners(); | |
void StopBatteryListeners(); | |
double ChargeLevel { get; } | |
BatteryState State { get; } | |
BatteryPowerSource PowerSource { get; } | |
} | |
public static partial class Battery | |
{ | |
private static IBattery mock; | |
public static IBattery Mock | |
{ | |
get => this.mock ?? throw new NotImplentedInReferenceAssembly(); | |
set => this.mock = value; | |
} | |
static void StartBatteryListeners() => Mock.StartBatteryListeners(); | |
static void StopBatteryListeners() => Mock.StopBatteryListeners(); | |
public static double ChargeLevel => Mock.ChargeLevel; | |
public static BatteryState State => Mock.State; | |
public static BatteryPowerSource PowerSource => Mock.PowerSource; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment