public void TestAtCompareReturnererSammenlignignsresultat(int xYear, int xMonth, int xDay, string xName, decimal xSaldo, int yYear, int yMonth, int yDay, string yName, decimal ySaldo, int expectedValue) { var xAdressekontoViewModelMock = MockRepository.GenerateMock <IAdressekontoViewModel>(); xAdressekontoViewModelMock.Expect(m => m.StatusDato) .Return(new DateTime(xYear, xMonth, xDay)) .Repeat.Any(); xAdressekontoViewModelMock.Expect(m => m.Navn) .Return(xName) .Repeat.Any(); xAdressekontoViewModelMock.Expect(m => m.Saldo) .Return(xSaldo) .Repeat.Any(); var yAdressekontoViewModelMock = MockRepository.GenerateMock <IAdressekontoViewModel>(); yAdressekontoViewModelMock.Expect(m => m.StatusDato) .Return(new DateTime(yYear, yMonth, yDay)) .Repeat.Any(); yAdressekontoViewModelMock.Expect(m => m.Navn) .Return(yName) .Repeat.Any(); yAdressekontoViewModelMock.Expect(m => m.Saldo) .Return(ySaldo) .Repeat.Any(); var comparer = new AdressekontoViewModelComparer(); Assert.That(comparer, Is.Not.Null); var result = comparer.Compare(xAdressekontoViewModelMock, yAdressekontoViewModelMock); Assert.That(result, Is.EqualTo(expectedValue)); }
public void TestAtCompareKasterArgumentNullExceptionHvisYErNull() { var fixture = new Fixture(); fixture.Customize <IAdressekontoViewModel>(e => e.FromFactory(() => MockRepository.GenerateMock <IAdressekontoViewModel>())); var comparer = new AdressekontoViewModelComparer(); Assert.That(comparer, Is.Not.Null); // ReSharper disable ReturnValueOfPureMethodIsNotUsed var exception = Assert.Throws <ArgumentNullException>(() => comparer.Compare(fixture.Create <IAdressekontoViewModel>(), null)); // ReSharper restore ReturnValueOfPureMethodIsNotUsed 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("y")); Assert.That(exception.InnerException, Is.Null); }
public void TestAtConstructorInitiererAdressekontoViewModelComparer() { var comparer = new AdressekontoViewModelComparer(); Assert.That(comparer, Is.Not.Null); }