public void AddPortToFirewallFact() { // Arrange var mockProcessRunner = new Mock <IProcessRunner>(MockBehavior.Strict); mockProcessRunner.Setup(m => m.Start(It.Is <Process>( p => p.StartInfo.FileName == "netsh.exe" && p.StartInfo.Arguments == @"firewall add portopening tcp 444 TestEasyTool"))) .Returns(true); mockProcessRunner.Setup(m => m.WaitForExit(It.Is <Process>( p => p.StartInfo.FileName == "netsh.exe" && p.StartInfo.Arguments == @"firewall add portopening tcp 444 TestEasyTool"), 60000)) .Returns(true); // Act // Assert var helper = new FirewallHelper(mockProcessRunner.Object); helper.AddPortToFirewall(444, "TestEasyTool"); }