public void clear_button_map() { var subDevice = Substitute.For <IHOTASDevice>(); subDevice.SetupNewModeProfile().Returns(43); subDevice.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(subDevice); var list = new HOTASCollection(Substitute.For <DirectInputFactory>(), Substitute.For <JoystickFactory>(), Substitute.For <HOTASQueueFactory>(Substitute.For <IKeyboard>()), subDeviceFactory); list.AddDevice(subDevice); list.ClearButtonMap(); subDevice.Received().ClearButtonMap(); }