public void VerifyThatSelectedItemCanOnlyContainSiteRdlRow() { var sessions = new List <ISession> { this.session.Object }; var viewmodel = new SiteRdlOpeningDialogViewModel(sessions); viewmodel.SelectedSiteRdls.Add(new SiteRdlSessionRowViewModel(this.siteDirectory, this.session.Object, null)); Assert.AreEqual(0, viewmodel.SelectedSiteRdls.Count); var siteRdl = new SiteReferenceDataLibrary(); viewmodel.SelectedSiteRdls.Add(new SiteRdlRowViewModel(siteRdl, this.session.Object, null)); Assert.AreEqual(1, viewmodel.SelectedSiteRdls.Count); }
public void VerifyThatReactiveCommandsCanBeExecuted() { var sessions = new List <ISession> { this.session.Object }; var viewmodel = new SiteRdlOpeningDialogViewModel(sessions); Assert.IsTrue(viewmodel.CancelCommand.CanExecute(null)); Assert.IsFalse(viewmodel.OpenCommand.CanExecute(null)); var siteRdl = new SiteReferenceDataLibrary(); viewmodel.SelectedSiteRdls.Add(new SiteRdlRowViewModel(siteRdl, this.session.Object, null)); Assert.IsTrue(viewmodel.OpenCommand.CanExecute(null)); }
public void VerifyThatPropertiesAreSet() { var sessions = new List <ISession> { this.session.Object }; var siteRdl = new SiteReferenceDataLibrary(); var viewmodel = new SiteRdlOpeningDialogViewModel(sessions); Assert.IsFalse(viewmodel.SelectedSiteRdls.Any()); Assert.IsNull(viewmodel.DialogResult); Assert.AreEqual(1, viewmodel.SessionsAvailable.Count); viewmodel.SelectedSiteRdls.Add(new SiteRdlRowViewModel(siteRdl, this.session.Object, null)); Assert.IsTrue(viewmodel.SelectedSiteRdls.Any()); }
public void VerifyThatCancelCommandsReturnCorrectResult() { var sessions = new List <ISession> { this.session.Object }; var viewmodel = new SiteRdlOpeningDialogViewModel(sessions); viewmodel.CancelCommand.Execute(null); Assert.NotNull(viewmodel.DialogResult); Assert.IsFalse((bool)viewmodel.DialogResult.Result); viewmodel.OpenCommand.Execute(null); Assert.NotNull(viewmodel.DialogResult); Assert.IsTrue((bool)viewmodel.DialogResult.Result); }