Skip to content

Instantly share code, notes, and snippets.

@Vector241-Eric
Created August 10, 2017 20:15
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 Vector241-Eric/8d01474a09e3ccf6a4571e64f1648c6e to your computer and use it in GitHub Desktop.
Save Vector241-Eric/8d01474a09e3ccf6a4571e64f1648c6e to your computer and use it in GitHub Desktop.
Move a light between groups
[TestFixture]
public class When_moving_a_light_from_one_group_to_another
{
private LightGroup _fooGroup;
private LightGroup _barGroup;
private Light _light;
[SetUp]
public void ContextSetup()
{
var model = new MasterModel();
_fooGroup = model.CreateProject().CreateGroup();
_barGroup = model.CreateProject().CreateGroup();
var zWaveIdentity = new ZWaveValueIdentity(1, 2, 123);
_light = new Light(zWaveIdentity);
_fooGroup.AddLight(_light);
model.AssignLightToGroup(zWaveIdentity, _barGroup.Id);
}
[Test]
public void Should_remove_the_light_from_the_original_group()
{
_fooGroup.Lights.Length.ShouldEqual(0);
}
[Test]
public void Should_add_the_light_to_the_new_group()
{
_barGroup.Lights.Length.ShouldEqual(1);
_barGroup.Lights[0].ZWaveIdentity.ValueId.ShouldEqual((ulong)123);
_light.ParentGroup.ShouldBeSameAs(_barGroup);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment