示例#1
0
        public void ShouldFindNextKakeAnsvarlig_WhenNoPreviousKakeAnsvarligExists()
        {
            KakeAnsvarlig previousKakeAnsvarlig = null;
            _kakeFordeler = new KakeFordeler(_kakeAnsvarlige, _ferieOversiktMock.Object, previousKakeAnsvarlig, DateTime.Now, DateTime.Now);

            KakeAnsvarlig expectedKakeAnsvarlig = _kakeAnsvarlige.First();
            Assert.That(_kakeFordeler.NextKakeAnsvarlig.Navn, Is.EqualTo(expectedKakeAnsvarlig.Navn));
        }
示例#2
0
        public void KakeFordelerShouldFindFirstFriday_WhenNoPreviousKakeDatoExistsAndNoHolidays()
        {
            DateTime today = new DateTime(2010, 04, 28);
            DateTime expectedKakeDato = new DateTime(2010, 04, 30);
            KakeFordeler kakeFordeler = new KakeFordeler(_kakeAnsvarlige, new FerieOversikt(new List<Ferie>()), null, DateTime.MinValue, today);

            Assert.That(kakeFordeler.NextKakeDato.ToShortDateString(), Is.EqualTo(expectedKakeDato.ToShortDateString()));
        }
示例#3
0
        public void ShouldFindNextKakeDato_WhenFerierIsNull()
        {
            DateTime today = new DateTime(2010, 04, 30);
            DateTime expectedKakeDato = new DateTime(2010, 05, 14);
            KakeFordeler kakeFordeler = new KakeFordeler(_kakeAnsvarlige, new FerieOversikt(new List<Ferie>()), null, today, today);

            kakeFordeler.FindNextKakeDato(today);

            Assert.That(kakeFordeler.NextKakeDato.ToShortDateString(), Is.EqualTo(expectedKakeDato.ToShortDateString()));
        }
示例#4
0
        public void ShouldFindNextKakeAnsvarlig()
        {
            KakeAnsvarlig previousKakeAnsvarlig = new KakeAnsvarlig(_kakeAnsvarlige.First().Navn, _kakeAnsvarlige.First().Epost);
            _kakeFordeler = new KakeFordeler(_kakeAnsvarlige, _ferieOversiktMock.Object, previousKakeAnsvarlig, DateTime.Now, DateTime.Now);

            _kakeFordeler.FindNextKakeAnsvarlig();

            KakeAnsvarlig expectedKakeAnsvarlig = _kakeAnsvarlige[1];
            Assert.That(_kakeFordeler.NextKakeAnsvarlig.Navn, Is.EqualTo(expectedKakeAnsvarlig.Navn));
        }
        public void SetUp()
        {
            _epostSenderMock = new Mock<IEpostSender>();
            _kakeFordelerRepositoryMock = new Mock<IKakeFordelerRepository>();
            _kakeFordelerService = new KakeFordelerService(_epostSenderMock.Object, _kakeFordelerRepositoryMock.Object);

            _nextKakeDato = new DateTime(2010, 04, 30);
            _nextKakeAnsvarlig = new KakeAnsvarlig("Roy", "*****@*****.**");
            _kakeFordeler = new KakeFordeler(null, null, _nextKakeAnsvarlig, _nextKakeDato, _nextKakeDato);

            _kakeFordelerRepositoryMock
                .Setup(m => m.GetFerieOversikt())
                .Returns(() => new FerieOversikt(new List<Ferie>()));

            _kakeFordelerRepositoryMock
                .Setup(m => m.GetMuligeKakeAnsvarlige())
                .Returns(() => new List<KakeAnsvarlig>() { new KakeAnsvarlig("", "") });
        }
示例#6
0
        public void ShouldFindNextKakeDato_WhenFridayInTwoWeeksIsAHoliday()
        {
            DateTime nextFriday = new DateTime(2010, 05, 14);
            SetupFerieOversiktMock(nextFriday, true);
            DateTime today = new DateTime(2010, 04, 30);
            DateTime expectedKakeDato = new DateTime(2010, 05, 21);
            KakeFordeler kakeFordeler = new KakeFordeler(_kakeAnsvarlige, _ferieOversiktMock.Object, null, today, today);

            kakeFordeler.FindNextKakeDato(today);

            Assert.That(kakeFordeler.NextKakeDato, Is.EqualTo(expectedKakeDato));
        }