Skip to content

Instantly share code, notes, and snippets.

@aloisdeniel
Created March 8, 2018 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aloisdeniel/a1debbc944223082afb8ee68cf136539 to your computer and use it in GitHub Desktop.
Save aloisdeniel/a1debbc944223082afb8ee68cf136539 to your computer and use it in GitHub Desktop.
Caboodle mock example
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