public void TestAtBogførAsyncBogførerValues()
        {
            var fixture = new Fixture();

            fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now));

            var finansstyringKonfigurationRepositoryMock = MockRepository.GenerateMock <IFinansstyringKonfigurationRepository>();

            finansstyringKonfigurationRepositoryMock.Expect(m => m.FinansstyringServiceUri)
            .Return(new Uri(FinansstyringServiceTestUri))
            .Repeat.Any();

            var finansstyringRepository = new FinansstyringRepository(finansstyringKonfigurationRepositoryMock);

            Assert.That(finansstyringRepository, Is.Not.Null);

            var task1 = finansstyringRepository.BogførAsync(1, fixture.Create <DateTime>(), null, "DANKORT", "Test", "8990", 5000M, 0M, 0);

            task1.Wait();

            Assert.That(task1.Result, Is.Not.Null);
            Assert.That(task1.Result.Bogføringslinje, Is.Not.Null);
            Assert.That(task1.Result.Bogføringsadvarsler, Is.Not.Null);

            var task2 = finansstyringRepository.BogførAsync(1, fixture.Create <DateTime>(), null, "DANKORT", "Test", "8990", 0M, 5000M, 0);

            task2.Wait();

            Assert.That(task2.Result, Is.Not.Null);
            Assert.That(task2.Result.Bogføringslinje, Is.Not.Null);
            Assert.That(task2.Result.Bogføringsadvarsler, Is.Not.Null);

            finansstyringKonfigurationRepositoryMock.AssertWasCalled(m => m.FinansstyringServiceUri);
        }
        public void TestAtBogførAsyncKasterArgumentExceptionVedIllegalKredit(decimal illegalValue)
        {
            var fixture = new Fixture();

            fixture.Customize <DateTime>(e => e.FromFactory(() => DateTime.Now));

            var finansstyringKonfigurationRepositoryMock = MockRepository.GenerateMock <IFinansstyringKonfigurationRepository>();

            var finansstyringRepository = new FinansstyringRepository(finansstyringKonfigurationRepositoryMock);

            Assert.That(finansstyringRepository, Is.Not.Null);

            var exception = Assert.Throws <ArgumentException>(() => finansstyringRepository.BogførAsync(fixture.Create <int>(), fixture.Create <DateTime>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <decimal>(), illegalValue, fixture.Create <int>()).Wait());

            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, "kredit", illegalValue)));
            Assert.That(exception.ParamName, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Empty);
            Assert.That(exception.ParamName, Is.EqualTo("kredit"));
            Assert.That(exception.InnerException, Is.Null);

            finansstyringKonfigurationRepositoryMock.AssertWasNotCalled(m => m.FinansstyringServiceUri);
        }
        public void TestAtBogførAsyncKasterArgumentExceptionVedIllegalDato(string illegalValue)
        {
            var fixture = new Fixture();

            var finansstyringKonfigurationRepositoryMock = MockRepository.GenerateMock <IFinansstyringKonfigurationRepository>();

            var finansstyringRepository = new FinansstyringRepository(finansstyringKonfigurationRepositoryMock);

            Assert.That(finansstyringRepository, Is.Not.Null);

            var dato      = Convert.ToDateTime(illegalValue, new CultureInfo("en-US"));
            var exception = Assert.Throws <ArgumentException>(() => finansstyringRepository.BogførAsync(fixture.Create <int>(), dato, fixture.Create <string>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <string>(), fixture.Create <decimal>(), fixture.Create <decimal>(), fixture.Create <int>()).Wait());

            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, "dato", dato)));
            Assert.That(exception.ParamName, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Empty);
            Assert.That(exception.ParamName, Is.EqualTo("dato"));
            Assert.That(exception.InnerException, Is.Null);

            finansstyringKonfigurationRepositoryMock.AssertWasNotCalled(m => m.FinansstyringServiceUri);
        }