public void Should_set_preferences_object() { IAppState setState = null; var storage = new Mock <IStorageProvider>(); storage.Setup(s => s.SetAppState(It.IsAny <IAppState>())).Returns <IAppState>((p) => { setState = p; return(true); }); var state = new AppState(); var service = new AppStateService(storage.Object, new Mock <IMapper>().Object); service.Save(state); setState.Should().Be(state); }