public void Abheben_during_Week_NoProblems() { var konto = new Konto(); konto.Einzahlen(10); using (ShimsContext.Create()) { // Monday System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 2); konto.Abheben(1); // Tuesday System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 3); konto.Abheben(1); // Wednesday System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 4); konto.Abheben(1); // Thursday System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 5); konto.Abheben(1); // Friday System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 6); konto.Abheben(1); } Assert.Equal(5, konto.Kontostand); }
public void Einzahlen_8_Abheben_3_and_2_Kontostand_3() { var konto = new Konto(); konto.Einzahlen(8); using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 2); konto.Abheben(3m); konto.Abheben(2m); } Assert.Equal(3m, konto.Kontostand); }
public void Konto_hat_nach_Abheben_korrekten_Kontostand() { var sut = new Konto(); sut.Einzahlen(new Geld(10)); sut.Abheben(new Geld(7)); sut.Kontostand.Value.Should().Be(3); }
public void Konto_gibt_nach_Abheben_korrekten_Wert_zurueck() { var sut = new Konto(); sut.Einzahlen(new Geld(10)); var abhebung = sut.Abheben(new Geld(7)); abhebung.Value.Should().Be(7); }
public void Abheben_more_than_kontostand_InvalidOperationExeption(decimal einzahlen, decimal auszahlen) { var konto = new Konto(); konto.Einzahlen(einzahlen); using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 2); Assert.Throws <InvalidOperationException>(() => konto.Abheben(auszahlen)); } }
public void Abheben_negative_values_ArgumentException(decimal value) { var konto = new Konto(); konto.Einzahlen(int.MaxValue); using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 2); Assert.Throws <ArgumentException>(() => konto.Abheben(value)); } }
public void Abheben_on_Sunday_InvalidOperationException() { var konto = new Konto(); konto.Einzahlen(10); using (ShimsContext.Create()) { // Sunday System.Fakes.ShimDateTime.NowGet = () => new DateTime(2017, 10, 8); output.WriteLine($"Sould be Sunday. Is: {DateTime.Now.DayOfWeek}"); Assert.Throws <InvalidOperationException>(() => konto.Abheben(5)); } }