Ejemplo n.º 1
0
 public static void TellDeviceStore(this IActorContext context, UpdateDevice message) => context.GetDeviceStore().Tell(message);
 public void WhenAClientRegistersByUpdatingADevice_ThenItShouldBeNotifiedOfDeviceConfigurationChanges()
 {
     var message = new UpdateDevice(FirstDeviceIdOfLastConfiguration, "bathroom", new Guid[0]);
     GivenClientHasRegistered(message, expectedMessages: 2);
 }
Ejemplo n.º 3
0
 public void WhenDeviceStoreIsRestartedAfterDeviceHasBeenUpdated_ThenTheDeviceConfigurationIsStillThere()
 {
     var message = new UpdateDevice(LastConfiguration.Devices[0].Id, "bedroom", new Guid[0]);
     SingleClientProxy.Tell(message);
     LastConfiguration = ExpectMsg<DeviceConfiguration>();
     RestartDeviceStore();
     AssertDeviceConfigurationThroughAddDevice(2, (m, d) =>
     {
         AssertDeviceIdFromLastConfiguration(d, 0);
         AssertDeviceIdFromLastConfiguration(d, 1);
         AssertDevice(m, d[0], "bedroom", new string[0]);
         AssertJustCreatedDevice(m, d[1], "dining room");
     });
 }
Ejemplo n.º 4
0
 public void WhenTwoControlsWithOverlappingActionsAreUsedInADevice_ThenTheSupportedActionsIsTheUnionOfTheTwoControlActions()
 {
     GivenPluginHasRegistered("fake2", new [] {new Control("1", "Super duper", new [] {"tUrNoFf", "blowup"}, new string[0])});
     var nextConfiguration = ExpectMsg<DeviceConfiguration>();
     var controlIds = new[] {0, 2}.Select(i => nextConfiguration.Controls[i].Id).ToArray();
     var message = new UpdateDevice(FirstDeviceIdOfLastConfiguration, "combined thingies", controlIds);
     SingleClientProxy.Tell(message);
     ExpectMsg<DeviceConfiguration>(m =>
     {
         m.Devices[0].SimpleActions.ShouldAllBeEquivalentTo(new [] {"turnon", "turnoff", "blowup"});
         m.Devices[0].SlidingActions.ShouldAllBeEquivalentTo(new [] {"dim"});
     });
 }
Ejemplo n.º 5
0
 public void WhenDeviceIsUpdated_ThenItShouldIndeedUpdateItsProperties()
 {
     var allControlIds = LastConfiguration.Controls.Select(c => c.Id).ToArray();
     var message = new UpdateDevice(FirstDeviceIdOfLastConfiguration, "all rooms", allControlIds);
     SingleClientProxy.Tell(message);
     ExpectMsg<DeviceConfiguration>(m =>
     {
         m.Devices.Length.Should().Be(2);
         AssertDevice(m, m.Devices[0], "all rooms", new []{ "kitchen", "dining room"});
         AssertControls(m, "kitchen", "dining room");
     });
 }