public void TestAtStatusDatoSetterRejserPropertyChangedVedOpdateringAfStatusDato(string propertyNameToRaise) { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var kontoModelBase = new MyKontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>()); Assert.That(kontoModelBase, Is.Not.Null); var eventCalled = false; kontoModelBase.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); kontoModelBase.StatusDato = kontoModelBase.StatusDato; Assert.That(eventCalled, Is.False); kontoModelBase.StatusDato = kontoModelBase.StatusDato.AddDays(7); Assert.That(eventCalled, Is.True); }
public void TestAtConstructorInitiererKontoModelBase() { 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 kontoModelBase = new MyKontoModel(regnskabsnummer, kontonummer, kontonavn, kontogruppe, statusDato); Assert.That(kontoModelBase, Is.Not.Null); Assert.That(kontoModelBase.Regnskabsnummer, Is.EqualTo(regnskabsnummer)); Assert.That(kontoModelBase.Kontonummer, Is.Not.Null); Assert.That(kontoModelBase.Kontonummer, Is.Not.Empty); Assert.That(kontoModelBase.Kontonummer, Is.EqualTo(kontonummer)); Assert.That(kontoModelBase.Kontonavn, Is.Not.Null); Assert.That(kontoModelBase.Kontonavn, Is.Not.Empty); Assert.That(kontoModelBase.Kontonavn, Is.EqualTo(kontonavn)); Assert.That(kontoModelBase.Beskrivelse, Is.Null); Assert.That(kontoModelBase.Notat, Is.Null); Assert.That(kontoModelBase.Kontogruppe, Is.EqualTo(kontogruppe)); Assert.That(kontoModelBase.StatusDato, Is.EqualTo(statusDato)); }
public void TestAtStatusDatoSetterOpdatererStatusDato() { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var kontoModelBase = new MyKontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>()); Assert.That(kontoModelBase, Is.Not.Null); var newValue = kontoModelBase.StatusDato.AddDays(7); Assert.That(kontoModelBase.StatusDato, Is.Not.EqualTo(newValue)); kontoModelBase.StatusDato = newValue; Assert.That(kontoModelBase.StatusDato, Is.EqualTo(newValue)); }
public void TestAtKontogruppeSetterOpdatererKontogruppe() { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var kontoModelBase = new MyKontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>()); Assert.That(kontoModelBase, Is.Not.Null); var newValue = fixture.Create <int>(); Assert.That(kontoModelBase.Kontogruppe, Is.Not.EqualTo(newValue)); kontoModelBase.Kontogruppe = newValue; Assert.That(kontoModelBase.Kontogruppe, Is.EqualTo(newValue)); }
public void TestAtKontonavnSetterKasterArgumentNullExceptionVedIllegalValue(string illegalValue) { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var kontoModelBase = new MyKontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>()); Assert.That(kontoModelBase, Is.Not.Null); var exception = Assert.Throws <ArgumentNullException>(() => kontoModelBase.Kontonavn = illegalValue); Assert.That(exception, Is.Not.Null); Assert.That(exception.ParamName, Is.Not.Null); Assert.That(exception.ParamName, Is.Not.Empty); Assert.That(exception.ParamName, Is.EqualTo("value")); Assert.That(exception.InnerException, Is.Null); }
public void TestAtKontogruppeSetterKasterArgumentExceptionVedIllegalValue(int illegalValue) { var fixture = new Fixture(); fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now)); var kontoModelBase = new MyKontoModel(fixture.Create <int>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <int>(), fixture.Create <DateTime>()); Assert.That(kontoModelBase, Is.Not.Null); var exception = Assert.Throws <ArgumentException>(() => kontoModelBase.Kontogruppe = illegalValue); Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.Not.Null); Assert.That(exception.Message, Is.Not.Empty); Assert.That(exception.Message, Does.StartWith(Resource.GetExceptionMessage(ExceptionMessage.IllegalArgumentValue, "value", illegalValue))); Assert.That(exception.ParamName, Is.Not.Null); Assert.That(exception.ParamName, Is.Not.Empty); Assert.That(exception.ParamName, Is.EqualTo("value")); Assert.That(exception.InnerException, Is.Null); }