Ejemplo n.º 1
0
        public void TestAtBrugerGetAllBySystemHenterBrugere()
        {
            var brugere = _kalenderRepository.BrugerGetAllBySystem(1);

            Assert.That(brugere, Is.Not.Null);
            Assert.That(brugere.Count(), Is.GreaterThan(0));
        }
Ejemplo n.º 2
0
        public void TestAtBrugerGetAllBySystemHenterBrugere()
        {
            IEnumerable <BrugerProxy> calenderUserProxyCollection = _fixture.CreateMany <BrugerProxy>(_random.Next(15, 25)).ToList();

            IKalenderRepository sut = CreateSut(calenderUserProxyCollection: calenderUserProxyCollection);

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

            int systemNo = _fixture.Create <int>();
            IEnumerable <IBruger> result = sut.BrugerGetAllBySystem(systemNo);

            // ReSharper disable PossibleMultipleEnumeration
            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(calenderUserProxyCollection));
            // ReSharper restore PossibleMultipleEnumeration

            IDbCommandTestExecutor commandTester = new DbCommandTestBuilder("SELECT cu.SystemNo,cu.UserId,cu.UserName,cu.Name,cu.Initials,s.Title,s.Properties FROM Calusers AS cu INNER JOIN Systems AS s ON s.SystemNo=cu.SystemNo WHERE cu.SystemNo=@systemNo ORDER BY cu.Name,cu.Initials,cu.UserId")
                                                   .AddSmallIntDataParameter("@systemNo", systemNo, 2)
                                                   .Build();

            _dataProviderMock.AssertWasCalled(m => m.GetCollection <BrugerProxy>(Arg <MySqlCommand> .Matches(cmd => commandTester.Run(cmd))), opt => opt.Repeat.Once());
        }
Ejemplo n.º 3
0
        public void TestAtBrugerGetAllBySystemKasterIntranetRepositoryExceptionVedException()
        {
            Exception exception = _fixture.Create <Exception>();

            IKalenderRepository sut = CreateSut(exception: exception);

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

            IntranetRepositoryException result = Assert.Throws <IntranetRepositoryException>(() => sut.BrugerGetAllBySystem(_fixture.Create <int>()));

            TestHelper.AssertIntranetRepositoryExceptionIsValid(result, exception, ExceptionMessage.RepositoryError, "BrugerGetAllBySystem", exception.Message);
        }
Ejemplo n.º 4
0
        public void TestAtBrugerGetAllBySystemKasterIntranetRepositoryExceptionVedIntranetRepositoryException()
        {
            IntranetRepositoryException intranetRepositoryException = _fixture.Create <IntranetRepositoryException>();

            IKalenderRepository sut = CreateSut(exception: intranetRepositoryException);

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

            IntranetRepositoryException result = Assert.Throws <IntranetRepositoryException>(() => sut.BrugerGetAllBySystem(_fixture.Create <int>()));

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.EqualTo(intranetRepositoryException));
        }