public void TestAtConstructorInitiererKontoModelUdenSaldoOgMedKredit() { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var regnskabsnummer = fixture.Create <int>(); var kontonummer = fixture.Create <string>(); var kontonavn = fixture.Create <string>(); var kontogruppe = fixture.Create <int>(); var statusDato = fixture.Create <DateTime>(); var kredit = fixture.Create <decimal>(); var kontoModel = new KontoModel(regnskabsnummer, kontonummer, kontonavn, kontogruppe, statusDato, 0M, kredit); Assert.That(kontoModel, Is.Not.Null); Assert.That(kontoModel.Regnskabsnummer, Is.EqualTo(regnskabsnummer)); Assert.That(kontoModel.Kontonummer, Is.Not.Null); Assert.That(kontoModel.Kontonummer, Is.Not.Empty); Assert.That(kontoModel.Kontonummer, Is.EqualTo(kontonummer)); Assert.That(kontoModel.Kontonavn, Is.Not.Null); Assert.That(kontoModel.Kontonavn, Is.Not.Empty); Assert.That(kontoModel.Kontonavn, Is.EqualTo(kontonavn)); Assert.That(kontoModel.Beskrivelse, Is.Null); Assert.That(kontoModel.Notat, Is.Null); Assert.That(kontoModel.Kontogruppe, Is.EqualTo(kontogruppe)); Assert.That(kontoModel.StatusDato, Is.EqualTo(statusDato)); Assert.That(kontoModel.Kredit, Is.EqualTo(kredit)); Assert.That(kontoModel.Saldo, Is.EqualTo(0)); Assert.That(kontoModel.Disponibel, Is.EqualTo(kredit)); }
public void TestAtSaldoSetterRejserPropertyChangedVedOpdateringAfSaldo(string propertyNameToRaise) { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var kontoModel = new KontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>(), fixture.Create <decimal>(), fixture.Create <decimal>()); Assert.That(kontoModel, Is.Not.Null); var eventCalled = false; kontoModel.PropertyChanged += (s, e) => { Assert.That(s, Is.Not.Null); Assert.That(e, Is.Not.Null); Assert.That(e.PropertyName, Is.Not.Null); Assert.That(e.PropertyName, Is.Not.Empty); if (string.Compare(e.PropertyName, propertyNameToRaise, StringComparison.Ordinal) == 0) { eventCalled = true; } }; Assert.That(eventCalled, Is.False); kontoModel.Saldo = kontoModel.Saldo; Assert.That(eventCalled, Is.False); kontoModel.Saldo = fixture.Create <decimal>(); Assert.That(eventCalled, Is.True); }
protected KontoTestBase(ITestOutputHelper output) : base(output) { AssertionOptions.AssertEquivalencyUsing(o => { o.Using <Transaktion>(t => t.Subject.ShouldBeEquivalentTo(t.Expectation, x => x.Excluding(p => p.Timestamp))) .WhenTypeIs <Transaktion>(); return(o); }); this.Konto = this.CreateKonto(); }
public void TestAtSaldoSetterOpdatererSaldo() { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var saldo = fixture.Create <decimal>(); var kredit = fixture.Create <decimal>(); var kontoModel = new KontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>(), saldo, kredit); Assert.That(kontoModel, Is.Not.Null); Assert.That(kontoModel.Kredit, Is.EqualTo(kredit)); Assert.That(kontoModel.Saldo, Is.EqualTo(saldo)); Assert.That(kontoModel.Disponibel, Is.EqualTo(kredit + saldo)); var newValue = fixture.Create <decimal>(); Assert.That(kontoModel.Saldo, Is.Not.EqualTo(newValue)); kontoModel.Saldo = newValue; Assert.That(kontoModel.Kredit, Is.EqualTo(kredit)); Assert.That(kontoModel.Saldo, Is.EqualTo(newValue)); Assert.That(kontoModel.Disponibel, Is.EqualTo(kredit + newValue)); }
public static void TransaktionenShouldBe(this KontoModel konto, params Transaktion[] transaktionen) { konto.LetzteTransaktion.ShouldBeEquivalentTo(transaktionen.Last(), CompareTransaktion); konto.Transaktionen.ShouldAllBeEquivalentTo(transaktionen, CompareTransaktion); }