This commit is contained in:
2022-04-29 11:55:26 +02:00
parent 61562e1081
commit cd5d88c998
17 changed files with 16 additions and 0 deletions

Binary file not shown.

View File

@@ -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.

View File

@@ -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();
}
} }
} }