private void OK() { if (string.IsNullOrEmpty(projectNameBox.Text)) { MessageBox.Show("项目名称不能为空"); projectNameBox.Focus(); DialogResult = System.Windows.Forms.DialogResult.None; return; } string newDir = Path.Combine(AppSettings.Instance.LibraryPath, projectNameBox.Text); if (Directory.Exists(newDir)) { MessageBox.Show(string.Format("{0}已经存在,请重新命名", projectNameBox.Text)); projectNameBox.Focus(); DialogResult = System.Windows.Forms.DialogResult.None; return; } bool result = HttpPing.Ping(StartUrl); if (result) { DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } else { MessageBox.Show("无效的地址"); startUrlBox.Focus(); DialogResult = System.Windows.Forms.DialogResult.None; } }
public void Should_Get_value_from_BBC_News() { var log = MockRepository.GenerateMock<ILog>(); var encryption = MockRepository.GenerateMock<IEncryption>(); Job job = new HttpPing(); var httpPing = new HttpPing(log, job, encryption); httpPing.Uri = "http://www.bbc.co.uk/news"; //Test var result = httpPing.Get(); //Assert Assert.That(result.Count, Is.EqualTo(1)); Assert.That(result[0].Value, Is.GreaterThanOrEqualTo(10)); Console.WriteLine(result[0].Value); }
public void Should_Get_value_from_BBC_News() { var log = MockRepository.GenerateMock <ILog>(); var encryption = MockRepository.GenerateMock <IEncryption>(); Job job = new HttpPing(); var httpPing = new HttpPing(log, job, encryption); httpPing.Uri = "http://www.bbc.co.uk/news"; //Test var result = httpPing.Get(); //Assert Assert.That(result.Count, Is.EqualTo(1)); Assert.That(result[0].Value, Is.GreaterThanOrEqualTo(10)); Console.WriteLine(result[0].Value); }