public void clear_unassigned_actions() { var subDevice1 = Substitute.For <IHOTASDevice>(); var subDevice2 = Substitute.For <IHOTASDevice>(); subDevice1.ButtonMap.Returns(new ObservableCollection <IHotasBaseMap>()); var subDeviceFactory = Substitute.For <HOTASDeviceFactory>(); subDeviceFactory.CreateHOTASDevice(Arg.Any <IDirectInput>(), Arg.Any <Guid>(), Arg.Any <Guid>(), Arg.Any <string>(), Arg.Any <IHOTASQueue>()).Returns(subDevice1); var list = new HOTASCollection(Substitute.For <DirectInputFactory>(), Substitute.For <JoystickFactory>(), Substitute.For <HOTASQueueFactory>(Substitute.For <IKeyboard>()), subDeviceFactory); list.AddDevice(subDevice1); subDevice2.ButtonMap.Returns(new ObservableCollection <IHotasBaseMap>()); subDeviceFactory.CreateHOTASDevice(Arg.Any <IDirectInput>(), Arg.Any <Guid>(), Arg.Any <Guid>(), Arg.Any <string>(), Arg.Any <IHOTASQueue>()).Returns(subDevice2); list.AddDevice(subDevice2); list.ListenToAllDevices(); list.ClearUnassignedActions(); subDevice1.Received().ClearUnassignedActions(); subDevice2.Received().ClearUnassignedActions(); }