public void Test辺の長さが正() { var triangle = new 三角形(2.0); Assert.AreEqual("三角形", triangle.Name); Assert.AreEqual(2.0, triangle.辺の長さ); Assert.AreEqual(1.7320508075689, triangle.面積, 3); }
public void Test辺の長さが0() { var triangle = new 三角形(0.0); Assert.AreEqual("三角形", triangle.Name); Assert.AreEqual(0.0, triangle.辺の長さ); Assert.AreEqual(0.0, triangle.面積, 3); }
public void TestAddRemove() { var figList = new 図形一覧(); var triangle = new 三角形(2.0); figList.Add(triangle); var square = new 四角形(2.0); figList.Add(square); Assert.AreEqual(2, figList.Items.Length); figList.Remove(triangle); Assert.AreEqual(1, figList.Items.Length); figList.Remove(square); Assert.AreEqual(0, figList.Items.Length); }