public void setup_new_mode_profile() { 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); var newMode = list.SetupNewModeProfile(); Assert.Equal(43, newMode); subDevice.Received().SetupNewModeProfile(); }