在C#中:
Assert.IsTrue(NewPagePost.IsInEditMode(), ""wasn't in edit mode");
Assert.AreEqual("Sample Page", NewPostPage.Title, "Title did not match");
Assert.IsTrue和Assert.AreEqual的Java替代方案是什么?
以下代码是否正确:
Assert.assertTrue("wasn't in edit mode", NewPostPage.IsInEditMode());
Assert.assertEquals("Sample Page,", NewPostPage.getTitle(),"Title did not match");
答案 0 :(得分:1)
Assert.assertTrue("wasn't in edit mode", NewPostPage.IsInEditMode());
Assert.assertEquals("Sample Page,", NewPostPage.getTitle(),"Title did not match");
以上看起来不错。
您可以将第二个语句重写为
Assert.assertTrue("Sample Page".equals(NewPostPage.getTitle()),"Title did not match");