update
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -7,11 +7,20 @@ using System.Threading.Tasks;
|
|||||||
namespace Negyszog {
|
namespace Negyszog {
|
||||||
public class Negyszog {
|
public class Negyszog {
|
||||||
public double oldal { get; set; }
|
public double oldal { get; set; }
|
||||||
|
public double oszlop;
|
||||||
|
|
||||||
public Negyszog(double oldal) {
|
public Negyszog(double oldal) {
|
||||||
this.oldal = oldal;
|
this.oldal = oldal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getOszlop(double oszlop) {
|
||||||
|
if(oszlop <= 0) {
|
||||||
|
throw new ArgumentException("A magasság negativ!");
|
||||||
|
} else {
|
||||||
|
this.oszlop = oszlop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public double Kerulet() {
|
public double Kerulet() {
|
||||||
return 4.0 * oldal;
|
return 4.0 * oldal;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,5 +27,12 @@ namespace NegyszogUnitTest {
|
|||||||
double kapotEredmeny = negyszog.Atlo();
|
double kapotEredmeny = negyszog.Atlo();
|
||||||
Assert.AreEqual(vartEredmeny, kapotEredmeny);
|
Assert.AreEqual(vartEredmeny, kapotEredmeny);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod, ExpectedException(typeof(ArgumentException))]
|
||||||
|
public void TestGetOszlop() {
|
||||||
|
double m = 1;
|
||||||
|
negyszog.getOszlop(m);
|
||||||
|
//Assert.Fail();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user