public void PrepCopiesPowershellRegFile() { // given Mock<ICopier> copier = new Mock<ICopier>(MockBehavior.Strict); copier .Setup(r => r.Copy( It.Is<Computer>(c => c.Name == "mycomputer" && c.NetworkCredential.Password == "foobah"), It.Is<string>(source => source.Contains("AllowRemotePowershellAccess.reg")), It.Is<string>(target => target.Contains("AllowRemotePowershellAccess.reg")))); // when Prep prep = new Prep(); StringWriter output = new StringWriter(); ConsoleCommandDispatcher.DispatchCommand( prep, new[] { "-computername", "mycomputer", "-adminpassword", "foobah" }, output); int result = prep.Run(new string[] { }); Assert.That(result, Is.EqualTo(0)); copier.VerifyAll(); }
public override void WritePrep(StreamWriter function) { base.WritePrep(function); if (Prep != null) { Prep.Invoke(function); } }
private void buildCountRequests() { foreach (Request currentRequest in requestList) { Prep tempPrepOne = prepList.Find(delegate(Prep curr) { return(curr.presenterName.Equals(currentRequest.RequestOne)); }); Prep tempPrepTwo = prepList.Find(delegate(Prep curr) { return(curr.presenterName.Equals(currentRequest.RequestTwo)); }); Prep tempPrepThree = prepList.Find(delegate(Prep curr) { return(curr.presenterName.Equals(currentRequest.RequestThree)); }); tempPrepOne.firstCount++; tempPrepTwo.secondCount++; tempPrepThree.thirdCount++; } }
private void buildPrepList() { prepList = new List <Prep>(); foreach (Request currentRequest in requestList) { Prep tempPrepOne, tempPrepTwo, tempPrepThree, tempPrepFour, tempPrepFive; tempPrepOne = prepList.Find(delegate(Prep curr) { return(currentRequest.RequestOne.Equals(curr.presenterName)); }); tempPrepTwo = prepList.Find(delegate(Prep curr) { return(currentRequest.RequestTwo.Equals(curr.presenterName)); }); tempPrepThree = prepList.Find(delegate(Prep curr) { return(currentRequest.RequestThree.Equals(curr.presenterName)); }); tempPrepFour = prepList.Find(delegate(Prep curr) { return(currentRequest.RequestFour.Equals(curr.presenterName)); }); tempPrepFive = prepList.Find(delegate(Prep curr) { return(currentRequest.RequestFive.Equals(curr.presenterName)); }); if (tempPrepOne == null) { tempPrepOne = new Prep(); tempPrepOne.presenterName = currentRequest.RequestOne; prepList.Add(tempPrepOne); } if (tempPrepTwo == null) { tempPrepTwo = new Prep(); tempPrepTwo.presenterName = currentRequest.RequestTwo; prepList.Add(tempPrepTwo); } if (tempPrepThree == null) { tempPrepThree = new Prep(); tempPrepThree.presenterName = currentRequest.RequestThree; prepList.Add(tempPrepThree); } if (tempPrepFour == null) { tempPrepFour = new Prep(); tempPrepFour.presenterName = currentRequest.RequestFour; prepList.Add(tempPrepFour); } if (tempPrepFive == null) { tempPrepFive = new Prep(); tempPrepFive.presenterName = currentRequest.RequestFive; prepList.Add(tempPrepFive); } } }
public void exportSampleDataFile() { FileInfo currentFile = new FileInfo(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\Career Fair Data File.xlsx"); if (currentFile.Exists) { currentFile = new FileInfo(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\Career Fair Data File (" + DateTime.Today.Month + "-" + DateTime.Today.Day + ").xlsx"); if (currentFile.Exists) { currentFile.Delete(); currentFile = new FileInfo(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "\\Career Fair Data File (" + DateTime.Today.Month + "-" + DateTime.Today.Day + ").xlsx"); } } using (ExcelPackage currentExcel = new ExcelPackage(currentFile)) { ExcelWorksheet currentSheet = currentExcel.Workbook.Worksheets.Add("Rooms"); currentSheet = currentExcel.Workbook.Worksheets.Add("Presenters"); int currentRowCounter = 2; currentSheet.Cells["A1"].Value = "Presenter"; currentSheet.Cells["B1"].Value = "Description"; currentSheet.Cells["C1"].Value = "Room"; for (int currentCount = 0; currentCount < prepList.Count; currentCount++) { Prep currentPrep = prepList[currentCount]; for (int prepRow = 0; prepRow < currentPrep.suggestedRooms; prepRow++) { currentSheet.Cells["A" + currentRowCounter].Value = currentPrep.presenterName + "-" + (prepRow + 1); currentRowCounter++; } } currentExcel.Save(); } }
public PrepWrap(Prep p) { this.p = p; }
public PrepMatch(Prep p, IEnumerable<string> w) { this.prep = p; this.words = w; }
static bool MatchPrep(Prep a, Prep b) { if (a == Prep.Wildcard || b == Prep.Wildcard) return true; if ((a == Prep.Any || b == Prep.Any) && (a != Prep.None && b != Prep.None)) { return true; } if ((a == Prep.None || b == Prep.None) && (a != Prep.None || b != Prep.None)) { return false; } return a == b; }