public void ChooseScriptSources_GivenNoincludeFile_ShouldNotaddFileToMsg() { //---------------Set up test pack------------------- var scriptChooser = new ScriptChooser(); var tempFileName = Path.GetTempFileName(); var chooseScriptSources = scriptChooser.ChooseScriptSources(string.Empty); bool wasCalled = false; chooseScriptSources.PropertyChanged += (sender, args) => { if (args.PropertyName == "SelectedFiles") { wasCalled = true; } }; chooseScriptSources.SelectedFiles = new List <string>() { }; //---------------Assert Precondition---------------- Assert.IsTrue(wasCalled); //---------------Execute Test ---------------------- //---------------Test Result ----------------------- Assert.AreEqual(0, chooseScriptSources.SelectedFiles.Count()); }
public void ChooseScriptSources_GivenFileSource_ShouldCallPropertyChange() { //---------------Set up test pack------------------- var scriptChooser = new ScriptChooser(); var tempFileName = Path.GetTempFileName(); var chooseScriptSources = scriptChooser.ChooseScriptSources(tempFileName); bool wasCalled = false; chooseScriptSources.PropertyChanged += (sender, args) => { if (args.PropertyName == "SelectedFiles") { wasCalled = true; } }; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- chooseScriptSources.SelectedFiles = new List <string>() { tempFileName }; //---------------Test Result ----------------------- Assert.IsTrue(wasCalled); }