public void SetUp() { _IWindow = Substitute.For<IWindow>(); _IWebServicesSettings = Substitute.For<IDiscogsAuthentificationProvider>(); _Infra = Substitute.For<IInfraDependencies>(); _Target = new ImportKeyViewModel(_IWebServicesSettings, _Infra) { Window = _IWindow }; }
public void Test_Commit_KO_IWebServicesSettings_False() { //IMusicSession ims = Substitute.For<IMusicSession>(); //ims.Setting.WebUserSettings.Returns(_IWebServicesSettings); //ims.Dependencies.Returns(_Infra); //IInfraDependencies iifd = Substitute.For<IInfraDependencies>(); _Target = new ImportKeyViewModel(_IWebServicesSettings, _Infra) { Window = _IWindow }; //_Infra.File.DirectoryExists(Arg.Any<string>()).Returns(true); var commit = _Target.Commit; _Target.Directory = "toto"; _Target.Password = "******"; _Target.FilePath = "fp"; _Infra.Zip.UnZipp("fp", "asticot").Returns(new string[] { "key", "Value" }); _IWebServicesSettings.ImportPrivateKeys(Arg.Any<IDictionary<string, string>>(), false).Returns(false); commit.Execute(null); _Infra.Zip.Received().UnZipp("fp", "asticot"); _IWebServicesSettings.Received().ImportPrivateKeys(Arg.Any<IDictionary<string, string>>(), false); _IWindow.DidNotReceive().Close(); _IWindow.Received().ShowMessage("Unable to import keys!", "Importing Discogs Key", false); }
private void DoImportDiscogs() { bool Force = false; if (_IWebServicesSettingsWrapper.IsDiscogImageActivated) { if (!this.Window.ShowConfirmationMessage("Caution the current keys will be overwritten and lost.\nDo not proceed if Discogs is working correctly.","Do you want to proceed?")) return; Force = true; } var import = new ImportKeyViewModel(_IWebServicesSettings.GetDiscogsAutentificator(), _IInfraDependencies) { Force = Force }; var importwndow = this.Window.CreateFromViewModel(import); importwndow.ShowDialog(); IsDiscogImageActivated = _IWebServicesSettingsWrapper.IsDiscogImageActivated; }