public void StartPopupWatcherTest_WithoutParameters_ThrowsException() { //Arrange var parentFolder = Substitute.For <RepoGenBaseFolder>("Form1", "/notExistent", null, Duration.Zero, true); var repoItemInfo = new RepoItemInfo(parentFolder, "self", RxPath.Parse(string.Empty), Duration.Zero, null); //Act + Assert Assert.Throws <ArgumentNullException>(() => PopupWatcherLibrary.StartPopupWatcher(repoItemInfo, null)); Assert.Throws <ArgumentNullException>(() => PopupWatcherLibrary.StartPopupWatcher(null, repoItemInfo)); }
public void StartPopupWatcherTest_Single_Success() { //Arrange var parentFolder = Substitute.For <RepoGenBaseFolder>("Form1", "/notExistent", null, Duration.Zero, true); var repoItemInfo = new RepoItemInfo(parentFolder, "self", RxPath.Parse(string.Empty), Duration.Zero, null); //Act var watcher = PopupWatcherLibrary.StartPopupWatcher(repoItemInfo, repoItemInfo); //Assert Assert.IsNotNull(watcher); Assert.AreEqual("Popup watcher started.", logger.LastLogMessage); }
public void StopAllPopupWatcherTest_RemovesAllEntries_Success() { //Arrange var parentFolder = Substitute.For <RepoGenBaseFolder>("Form1", "/notExistent", null, Duration.Zero, true); var repoItemInfo1 = new RepoItemInfo(parentFolder, "self", RxPath.Parse(string.Empty), Duration.Zero, null, Guid.NewGuid().ToString()); var repoItemInfo2 = new RepoItemInfo(parentFolder, "self", RxPath.Parse(string.Empty), Duration.Zero, null, Guid.NewGuid().ToString()); PopupWatcherLibrary.StartPopupWatcher(repoItemInfo1, repoItemInfo1); PopupWatcherLibrary.StartPopupWatcher(repoItemInfo2, repoItemInfo2); //Act PopupWatcherLibrary.StopAllPopupWatchers(); //Assert Assert.AreEqual("Popup watcher stopped.", logger.LastLogMessage); Assert.AreEqual(0, PopupWatcherLibrary.Watchers.Count); }
public void StopPopupWatcherTest_Single_Success() { //Arrange var parentFolder = Substitute.For <RepoGenBaseFolder>("Form1", "/form", null, Duration.Zero, true); var repoItemInfo = new RepoItemInfo(parentFolder, "self", RxPath.Parse(string.Empty), Duration.Zero, null, Guid.NewGuid().ToString()); var logger = new TestReportLogger(); Report.AttachLogger(logger); var watcher = PopupWatcherLibrary.StartPopupWatcher(repoItemInfo, repoItemInfo); //Act PopupWatcherLibrary.StopPopupWatcher(repoItemInfo, repoItemInfo); //Assert Report.DetachLogger(logger); Assert.IsNotNull(watcher); Assert.AreEqual("Popup watcher stopped.", logger.LastLogMessage); }
public void StartPopupWatcherTest_Twice_ThrowsException() { //Arrange var parentFolder = Substitute.For <RepoGenBaseFolder>("Form1", "/notExistent", null, Duration.Zero, true); var repoItemInfo = new RepoItemInfo(parentFolder, "self", RxPath.Parse(string.Empty), Duration.Zero, null, Guid.NewGuid().ToString()); //Act try { PopupWatcherLibrary.StartPopupWatcher(repoItemInfo, repoItemInfo); PopupWatcherLibrary.StartPopupWatcher(repoItemInfo, repoItemInfo); //Assert Assert.Fail(); } catch (ArgumentException ex) { Assert.AreEqual("Popup watcher with given parameters already exists.", ex.Message); } }