public void Test_Property_Changes(Expression <Func <EditorOptions, bool> > getter, Action <EditorOptions, bool> setter) { // Act/Assert. AssertThat.PropertyChanged(options, getter, () => setter(options, true)); }
public void Test_Content_RaisesPropertyChange() { // Arrange. var diagram = new Diagram(); // Act/Assert. AssertThat.PropertyChanged(diagram, p => p.Content, () => diagram.Content = "blargh"); }
public void Test_PropertyBuilder_PropertyAsDifferentType() { // Arrange. Property <object> property = Property.New(this, p => p.IntValue as object, OnPropertyChanged); // Act/Assert. AssertThat.PropertyChanged(this, p => p.IntValue, () => property.Value = 10); Assert.Equal(10, property.Value); }
public void Test_ImageFile_RaisesPropertyChange() { // Arrange. var diagram = new Diagram { ImageFile = new FileInfo("image.svg") }; // Act/Assert. AssertThat.PropertyChanged(diagram, p => p.ImageFile, () => diagram.ImageFile = new FileInfo("image.png")); }
public void Test_Title_PropertyChange_Propagates() { // Arrange. var testCase = new Mock <ITestCase>(); var vm = new TestCaseViewModel(testCase.Object, automationService.Object); // Act/Assert. AssertThat.PropertyChanged(vm, p => p.Title, () => testCase.Raise(tc => tc.PropertyChanged += null, new PropertyChangedEventArgs("Title"))); }
public void Test_Implementation_PropertyChange_Propagates_To_CanRemoveAutomation() { // Arrange. var testCase = new Mock <ITestCase>(); var vm = new TestCaseViewModel(testCase.Object, automationService.Object); // Act/Assert. AssertThat.PropertyChanged(vm, p => p.CanRemoveAutomation, () => testCase.Raise(tc => tc.PropertyChanged += null, new PropertyChangedEventArgs("Implementation"))); }
public void Test_AutoSaveInterval_Changes() { // Arrange. viewModel.AutoSaveInterval = TimeSpan.FromSeconds(0); // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.AutoSaveInterval, () => viewModel.AutoSaveInterval = TimeSpan.FromSeconds(30)); Assert.Equal(TimeSpan.FromSeconds(30), viewModel.AutoSaveInterval); }
public void Test_MaximumCount_Changes() { // Arrange. recentFiles.MaximumCount = 0; // Act/Assert. AssertThat.PropertyChanged(recentFiles, r => r.MaximumCount, () => recentFiles.MaximumCount = 15); Assert.Equal(15, recentFiles.MaximumCount); }
public void Test_MaximumRecentFiles_Changes() { // Arrange. viewModel.MaximumRecentFiles = 0; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.MaximumRecentFiles, () => viewModel.MaximumRecentFiles = 6); Assert.Equal(6, viewModel.MaximumRecentFiles); }
public void Test_ShowLineNumbers_Changes() { // Arrange. viewModel.ShowLineNumbers = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.ShowLineNumbers, () => viewModel.ShowLineNumbers = true); Assert.True(viewModel.ShowLineNumbers); }
public void Test_HighlightCurrentLine_Changes() { // Arrange. viewModel.HighlightCurrentLine = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.HighlightCurrentLine, () => viewModel.HighlightCurrentLine = true); Assert.True(viewModel.HighlightCurrentLine); }
public void Test_EnableWordWrap_Changes() { // Arrange. viewModel.EnableWordWrap = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.EnableWordWrap, () => viewModel.EnableWordWrap = true); Assert.True(viewModel.EnableWordWrap); }
public void Test_EnableVirtualSpace_Changes() { // Arrange. viewModel.EnableVirtualSpace = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.EnableVirtualSpace, () => viewModel.EnableVirtualSpace = true); Assert.True(viewModel.EnableVirtualSpace); }
public void Test_EmptySelectionCopiesEntireLine_Changes() { // Arrange. viewModel.EmptySelectionCopiesEntireLine = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.EmptySelectionCopiesEntireLine, () => viewModel.EmptySelectionCopiesEntireLine = true); Assert.True(viewModel.EmptySelectionCopiesEntireLine); }
public void Test_AllowScrollingBelowContent_Changes() { // Arrange. viewModel.AllowScrollingBelowContent = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.AllowScrollingBelowContent, () => viewModel.AllowScrollingBelowContent = true); Assert.True(viewModel.AllowScrollingBelowContent); }
public void Test_AutoSaveEnabled_Changes() { // Arrange. viewModel.AutoSaveEnabled = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.AutoSaveEnabled, () => viewModel.AutoSaveEnabled = true); Assert.True(viewModel.AutoSaveEnabled); }
public void Test_RememberOpenFiles_Changes() { // Arrange. viewModel.RememberOpenFiles = false; // Act/Assert. AssertThat.PropertyChanged(viewModel, s => s.RememberOpenFiles, () => viewModel.RememberOpenFiles = true); Assert.True(viewModel.RememberOpenFiles); }
public void Test_EqualWhen_Changes() { // Arrange. Property <int> property = Property.New(this, x => x.IntValue, OnPropertyChanged) .EqualWhen((older, newer) => older > newer); property.Value = -1; // Act/Assert. AssertThat.PropertyChanged(this, x => x.IntValue, () => property.Value = 4); }
public void Test_Notify() { // Arrange. var notification = new Notification("Test"); // Act/Assert. AssertThat.PropertyChanged(notifications, p => p.LatestNotification, () => notifications.Notify(notification)); Assert.Equal(notification, notifications.LatestNotification); Assert.Single(notifications.Notifications); Assert.Equal(notification, notifications.Notifications.Single()); }
public void Test_AllowScrollingBelowContent_Changes() { // Arrange. settings.AllowScrollingBelowContent = false; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.AllowScrollingBelowContent, () => appSettings.AllowScrollingBelowContent = true); Assert.True(appSettings.AllowScrollingBelowContent); }
public void Test_RememberOpenFiles_Changes() { // Arrange. settings.RememberOpenFiles = true; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.RememberOpenFiles, () => appSettings.RememberOpenFiles = false); Assert.False(appSettings.RememberOpenFiles); }
public void Test_HighlightCurrentLine_Changes() { // Arrange. settings.HighlightCurrentLine = false; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.HighlightCurrentLine, () => appSettings.HighlightCurrentLine = true); Assert.True(appSettings.HighlightCurrentLine); }
public void Test_ShowLineNumbers_Changes() { // Arrange. settings.ShowLineNumbers = false; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.ShowLineNumbers, () => appSettings.ShowLineNumbers = true); Assert.True(appSettings.ShowLineNumbers); }
public void Test_AutoSaveInterval_Changes() { // Arrange. settings.AutoSaveInterval = TimeSpan.FromSeconds(0); var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.AutoSaveInterval, () => appSettings.AutoSaveInterval = TimeSpan.FromSeconds(30)); Assert.Equal(TimeSpan.FromSeconds(30), appSettings.AutoSaveInterval); }
public void Test_LastDiagramLocation_Changes() { // Arrange. settings.LastPath = @"C:\Initial"; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.LastDiagramLocation, () => appSettings.LastDiagramLocation = new DirectoryInfo(@"C:\New")); Assert.Equal(@"C:\New", appSettings.LastDiagramLocation.FullName); }
public void Test_AutoSaveEnabled_Changes() { // Arrange. settings.AutoSaveEnabled = false; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.AutoSaveEnabled, () => appSettings.AutoSaveEnabled = true); Assert.True(appSettings.AutoSaveEnabled); }
public void Test_MaximumRecentFiles_Changes() { // Arrange. settings.MaximumRecentFiles = 5; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.MaximumRecentFiles, () => appSettings.MaximumRecentFiles = 15); Assert.Equal(15, appSettings.MaximumRecentFiles); }
public void Test_EmptySelectionCopiesEntireLine_Changes() { // Arrange. settings.EmptySelectionCopiesEntireLine = false; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.EmptySelectionCopiesEntireLine, () => appSettings.EmptySelectionCopiesEntireLine = true); Assert.True(appSettings.EmptySelectionCopiesEntireLine); }
public void Test_TfsProjectName_Changes() { // Arrange. _settings.TFSProjectName = "project1"; var appSettings = new DotNetSettings(_settings); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.TfsProjectName, () => appSettings.TfsProjectName = "project2"); Assert.Equal("project2", appSettings.TfsProjectName); }
public void Test_EnableWordWrap_Changes() { // Arrange. settings.EnableWordWrap = false; var appSettings = new DotNetSettings(settings, new DirectoryInfo(@"C:\")); // Act/Assert. AssertThat.PropertyChanged(appSettings, s => s.EnableWordWrap, () => appSettings.EnableWordWrap = true); Assert.True(appSettings.EnableWordWrap); }