コード例 #1
0
        public void When_adding_devices_in_role_intermediate_timer_they_must_be_stored()
        {
            // Arrange
            var timer1 = new WirelessNetworkAddress("AAAAAA");
            var timer2 = new WirelessNetworkAddress("BBBBBB");
            var timer3 = new WirelessNetworkAddress("CCCCCC");
            NetworkComposition composition = new NetworkCompositionBuilder().Build();

            // Act
            composition = composition.ChangeRolesFor(timer1, DeviceCapabilities.IntermediateSensor,
                DeviceRoles.IntermediateTimer1);
            composition = composition.ChangeRolesFor(timer2, DeviceCapabilities.IntermediateSensor,
                DeviceRoles.IntermediateTimer2);
            composition = composition.ChangeRolesFor(timer3, DeviceCapabilities.IntermediateSensor,
                DeviceRoles.IntermediateTimer3);

            // Assert
            composition.IsInRoleIntermediateTimer1(timer1).Should().BeTrue();
            composition.IsInRoleIntermediateTimer2(timer2).Should().BeTrue();
            composition.IsInRoleIntermediateTimer3(timer3).Should().BeTrue();
        }
コード例 #2
0
        public void When_adding_a_device_with_an_empty_role_it_must_not_be_in_any_known_roles()
        {
            // Arrange
            const DeviceRoles emptyRole = DeviceRoles.None;
            NetworkComposition composition = new NetworkCompositionBuilder().Build();

            // Act
            composition = composition.ChangeRolesFor(DeviceAddress, DeviceCapabilities.FinishSensor, emptyRole);

            // Assert
            composition.IsInRoleStartTimer(DeviceAddress).Should().BeFalse();
            composition.IsInRoleIntermediateTimer1(DeviceAddress).Should().BeFalse();
            composition.IsInRoleIntermediateTimer2(DeviceAddress).Should().BeFalse();
            composition.IsInRoleIntermediateTimer3(DeviceAddress).Should().BeFalse();
            composition.IsInRoleFinishTimer(DeviceAddress).Should().BeFalse();
            composition.IsStartFinishGate(DeviceAddress).Should().BeFalse();
        }