Example #1
0
        public HomeControllerTest()
        {
            _dummyContext          = new DummyApplicationDbContext();
            _mockCommentRepository = new Mock <ICommentRepository>();

            _mockCommentRepository.Setup(m => m.GetById(_commentId)).Returns(_dummyContext.CommentWithId1);
            _mockCommentRepository.Setup(m => m.GetById(2)).Returns(_dummyContext.Comments.Skip(1).First);
            _mockCommentRepository.Setup(m => m.GetById(3)).Returns(_dummyContext.Comments.Skip(2).First);
            _mockCommentRepository.Setup(m => m.GetById(4)).Returns(_dummyContext.Comments.Skip(3).First);
            _mockCommentRepository.Setup(m => m.GetById(5)).Returns(_dummyContext.Comments.Skip(4).First);
            _mockCommentRepository.Setup(m => m.GetById(6)).Returns(_dummyContext.Comments.Skip(5).First);

            _homeController = new HomeController(_mockCommentRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };
        }
Example #2
0
        public CartControllerTest()
        {
            var context = new DummyApplicationDbContext();

            var productRepository = new Mock <IProductRepository>();

            productRepository.Setup(p => p.GetById(4)).Returns(context.RunningShoes);
            productRepository.Setup(p => p.GetById(1)).Returns(context.Football);

            _controller = new CartController(productRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };

            _cart = new Cart();
            _cart.AddLine(context.Football, 2);
        }
Example #3
0
        public WerkgeverControllerTest()
        {
            _analyseRepository      = new Mock <IAnalyseRepository>();
            _departementRepository  = new Mock <IDepartementRepository>();
            _werkgeverRepository    = new Mock <IWerkgeverRepository>();
            _exceptionLogRepository = new Mock <IExceptionLogRepository>();
            _jobcoachRepository     = new Mock <IJobcoachRepository>();

            _controller = new WerkgeverController(_analyseRepository.Object,
                                                  _departementRepository.Object, _werkgeverRepository.Object, _exceptionLogRepository.Object,
                                                  _jobcoachRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };

            _analyse   = new Mock <Analyse>();
            _dbContext = new DummyApplicationDbContext();
        }
Example #4
0
        public MotivationControllerTest()
        {
            _context = new DummyApplicationDbContext();

            Mock <IGroupRepository> groupRepo = new Mock <IGroupRepository>();

            groupRepo.Setup(g => g.GetAll()).Returns(_context.Groups);
            groupRepo.Setup(g => g.GetBy(1)).Returns(_context.HogentGroup);
            groupRepo.Setup(o => o.GetBy(2)).Returns(_context.HogentGroupSubmitted);
            groupRepo.Setup(g => g.GetBy(3)).Returns(_context.HogentGroupApproved);
            groupRepo.Setup(o => o.GetBy(4)).Returns(_context.HogentGroupGranted);
            groupRepo.Setup(g => g.GetBy(5)).Returns(_context.HogentGroupAnnounced);

            _controller          = new MotivationController(groupRepo.Object);
            _controller.TempData = new Mock <ITempDataDictionary>().Object;

            _ownerHogent          = _context.OwnerHogent.UserState as Participant;
            _ownerHogentSubmitted = _context.OwnerHogentSubmitted.UserState as Participant;
        }
        public ProductControllerTest()
        {
            _dummyContext           = new DummyApplicationDbContext();
            _mockProductRepository  = new Mock <IProductRepository>();
            _mockCategoryRepository = new Mock <ICategoryRepository>();
            _runningShoes           = _dummyContext.RunningShoes;
            _runningShoesId         = _runningShoes.ProductId;
            _mockProductRepository.Setup(p => p.GetAll()).Returns(_dummyContext.Products);
            _mockProductRepository.Setup(p => p.GetById(_runningShoesId)).Returns(_dummyContext.RunningShoes);
            _mockProductRepository.Setup(p => p.GetById(_nonExistingProductId)).Returns(null as Product);
            _mockProductRepository.Setup(p => p.GetByCategory(_soccerId)).Returns(_dummyContext.Soccer.Products);
            _mockProductRepository.Setup(p => p.Delete(_dummyContext.RunningShoes));
            _mockCategoryRepository.Setup(p => p.GetAll()).Returns(_dummyContext.Categories);
            _mockCategoryRepository.Setup(c => c.GetById(It.IsAny <int>())).Returns(_dummyContext.Soccer);

            _productController = new ProductController(_mockProductRepository.Object, _mockCategoryRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };
        }
        public GroupControllerTest()
        {
            _context = new DummyApplicationDbContext();

            Mock <IGroupRepository>       groupRepo       = new Mock <IGroupRepository>();
            Mock <IParticipantRepository> participantRepo = new Mock <IParticipantRepository>();
            Mock <IInvitationRepository>  invRepo         = new Mock <IInvitationRepository>();
            Mock <ILabelRepository>       lRepo           = new Mock <ILabelRepository>();
            Mock <IPostRepository>        postRepo        = new Mock <IPostRepository>();

            groupRepo.Setup(g => g.GetAll()).Returns(_context.Groups);
            groupRepo.Setup(g => g.GetBy(1)).Returns(_context.HogentGroup);

            _controller          = new GroupController(groupRepo.Object, participantRepo.Object, invRepo.Object, lRepo.Object, postRepo.Object);
            _controller.TempData = new Mock <ITempDataDictionary>().Object;

            _participantHogent = _context.ParticipantHogent.UserState as Participant;
            _ownerHogent       = _context.OwnerHogent.UserState as Participant;
            _ownerGranted      = _context.OwnerHogentGranted.UserState as Participant;
        }
Example #7
0
        public BestellingenControllerTest()
        {
            DummyApplicationDbContext context = new DummyApplicationDbContext();

            _mockGebruikersRepository = new Mock <IGebruikersRepository>();
            _jan                 = context.Jan;
            _controller          = new BestellingenController(_mockGebruikersRepository.Object);
            _controller.TempData = new Mock <ITempDataDictionary>().Object;
            _model               = new NieuwViewModel(9.0M)
            {
                Elektronisch  = true,
                AantalCheques = 20,
                DebiteerDatum = DateTime.Today
            };
            _modelMetFout = new NieuwViewModel(9.0M)
            {
                Elektronisch  = true,
                AantalCheques = 70,
                DebiteerDatum = DateTime.Today
            };
        }
        public ArchiefControllerTest()
        {
            _dbContext              = new DummyApplicationDbContext();
            _analyseRepository      = new Mock <IAnalyseRepository>();
            _exceptionLogRepository = new Mock <IExceptionLogRepository>();
            _analyse = new Analyse {
                AnalyseId = 2, InArchief = true
            };
            _analyseAldi = new Analyse {
                AnalyseId = 1, Departement = _dbContext.Aldi, InArchief = true
            };

            _controller =
                new ArchiefController(_analyseRepository.Object, _exceptionLogRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };
            _dbContext.Thomas.Analyses.Add(new Analyse {
                AnalyseId = 1
            });
        }
Example #9
0
 public CartControllerTest()
 {
     _context        = new DummyApplicationDbContext();
     _beerRepository = new Mock <IBeerRepository>();
     _beerRepository.Setup(b => b.GetAll()).Returns(_context.Beers);
     _locationRepository = new Mock <ILocationRepository>();
     _locationRepository.Setup(b => b.GetAll()).Returns(_context.Locations);
     _customerRepository = new Mock <ICustomerRepository>();
     _customerRepository.Setup(b => b.GetBy("*****@*****.**")).Returns(_context.CustomerJan);
     _controller = new CartController(_beerRepository.Object, _locationRepository.Object, _customerRepository.Object)
     {
         TempData = new Mock <ITempDataDictionary>().Object
     };
     _cart        = _context.CartFilled;
     _customerJan = _context.CustomerJan;
     _shippingVm  = new ShippingViewModel {
         DeliveryDate = DateTime.Today.AddDays(5).DayOfWeek == DayOfWeek.Sunday ? DateTime.Today.AddDays(6) : DateTime.Today.AddDays(5),
         Giftwrapping = true,
         PostalCode   = _context.Bavikhove.PostalCode,
         Street       = "Bavikhovestraat"
     };
 }
Example #10
0
        public void TestGeefTotalenKosten()
        {
            DummyApplicationDbContext dbContext = new DummyApplicationDbContext();

            IDictionary <Soort, decimal> expected = new Dictionary <Soort, decimal>
            {
                { Soort.Loonkost, 80430.81M },
                { Soort.ExtraKost, 1550M },
                { Soort.BegeleidingsKost, 2437.11M },
                { Soort.EnclaveKost, 72000M },
                { Soort.VoorbereidingsKost, 21500M },
                { Soort.PersoneelsKost, 17200M },
                { Soort.GereedschapsKost, 12300M },
                { Soort.OpleidingsKost, 4700M }
            };

            _analyse = new Analyse
            {
                Departement = dbContext.Aldi,

                /* KOSTEN */
                Loonkosten           = dbContext.Loonkosten,
                ExtraKosten          = dbContext.ExtraKosten,
                BegeleidingsKosten   = dbContext.BegeleidingsKosten,
                OpleidingsKosten     = dbContext.OpleidingsKosten,
                PersoneelsKosten     = dbContext.PersoneelsKosten,
                GereedschapsKosten   = dbContext.GereedschapsKosten,
                VoorbereidingsKosten = dbContext.VoorbereidingsKosten,
                EnclaveKosten        = dbContext.EnclaveKosten
            };

            IDictionary <Soort, decimal> totalen = _analyse.GeefTotalenKosten();

            foreach (KeyValuePair <Soort, decimal> pair in totalen)
            {
                decimal totaal = Math.Round(pair.Value, 2);
                Assert.Equal(expected[pair.Key], totaal);
            }
        }
        public LabelControllerTest()
        {
            _context = new DummyApplicationDbContext();

            Mock <ICompanyRepository> compRepo  = new Mock <ICompanyRepository>();
            Mock <IGroupRepository>   groupRepo = new Mock <IGroupRepository>();

            compRepo.Setup(c => c.GetAll()).Returns(_context.Companies);
            compRepo.Setup(c => c.GetBy(1)).Returns(_context.Company1);
            compRepo.Setup(c => c.GetBy(2)).Returns(_context.Company2);
            compRepo.Setup(c => c.GetBy(3)).Returns(_context.Company3);

            groupRepo.Setup(g => g.GetAll()).Returns(_context.Groups);
            groupRepo.Setup(g => g.GetBy(1)).Returns(_context.HogentGroup);
            groupRepo.Setup(g => g.GetBy(2)).Returns(_context.HogentGroupSubmitted);
            groupRepo.Setup(g => g.GetBy(3)).Returns(_context.HogentGroupApproved);
            groupRepo.Setup(g => g.GetBy(4)).Returns(_context.HogentGroupGranted);
            groupRepo.Setup(g => g.GetBy(5)).Returns(_context.HogentGroupAnnounced);

            _controller = new LabelController(compRepo.Object, groupRepo.Object);

            _ownerApproved = _context.OwnerHogentApproved.UserState as Participant;
        }
Example #12
0
        public ResultaatControllerTest()
        {
            _dbContext = new DummyApplicationDbContext();

            _analyse = new Analyse
            {
                Departement = _dbContext.Aldi,

                Loonkosten                   = _dbContext.Loonkosten,
                ExtraKosten                  = _dbContext.ExtraKosten,
                BegeleidingsKosten           = _dbContext.BegeleidingsKosten,
                MedewerkersZelfdeNiveauBaten = _dbContext.MedewerkerNiveauBaten,
                UitzendKrachtBesparingen     = _dbContext.UitzendKrachtBesparingen,
                ExterneInkopen               = _dbContext.ExterneInkopen,
                OpleidingsKosten             = _dbContext.OpleidingsKosten,
                PersoneelsKosten             = _dbContext.PersoneelsKosten,
                GereedschapsKosten           = _dbContext.GereedschapsKosten,
                VoorbereidingsKosten         = _dbContext.VoorbereidingsKosten,
                EnclaveKosten                = _dbContext.EnclaveKosten,
                Subsidie            = _dbContext.Subsidie,
                LogistiekeBesparing = _dbContext.LogistiekeBesparing
            };

            _analyseRepo            = new Mock <IAnalyseRepository>();
            _exceptionLogRepository = new Mock <IExceptionLogRepository>();

            _controller =
                new ResultaatController(_analyseRepo.Object, _exceptionLogRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };

            _dbContext.Thomas.Analyses.Add(new Analyse {
                AnalyseId = 1
            });
        }
        public SessieControllerTest()
        {
            _dummyContext            = new DummyApplicationDbContext();
            _mockSessieRepository    = new Mock <ISessieRepository>();
            _mockGebruikerRepository = new Mock <IGebruikerRepository>();
            _mockFeedbackRepository  = new Mock <IFeedbackRepository>();
            _sessieController        = new SessieController(_mockSessieRepository.Object, _mockGebruikerRepository.Object, _mockFeedbackRepository.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object
            };
            _huidigeMaand           = DateTime.Now.Month;
            _gebruiker              = _dummyContext.Gebruiker;
            _verantwoordelijkeLeeg  = _dummyContext.VerantwoordelijkeLeeg;
            _verantwoordelijke      = _dummyContext.Verantwoordelijke;
            _hoofdverantwoordelijke = _dummyContext.Hoofdverantwoordelijke;
            _sessie  = _dummyContext.Sessie1;
            _sessie2 = _dummyContext.Sessie2;
            _sessie3 = _dummyContext.Sessie3;
            _sessie6 = _dummyContext.Sessie6;
            _sessie7 = _dummyContext.Sessie7;
            _sessie8 = _dummyContext.Sessie8;

            _feedback = _dummyContext.Feedback;
        }
 public ReviewControllerTest()
 {
     dadc = new DummyApplicationDbContext();
     mirr = new Mock <IReviewRepository>();
     rc   = new ReviewController(mirr.Object);
 }
Example #15
0
 public MedewerkerNiveauBaatExtensionsTest()
 {
     _dbContext = new DummyApplicationDbContext();
 }
 public KostOfBaatExtensionsTest()
 {
     _dbContext = new DummyApplicationDbContext();
 }
Example #17
0
 public LinkTest()
 {
     _dummyContext = new DummyApplicationDbContext();
     this.Link     = _dummyContext.LinkGoogle;
 }
 public CalendarControllerTest()
 {
     _dummyContext       = new DummyApplicationDbContext();
     _sessionRepo        = new Mock <ISessionRepository>();
     _calendarController = new CalendarController(_sessionRepo.Object);
 }
Example #19
0
        public LoonkostExtensionsTest()
        {
            DummyApplicationDbContext dbContext = new DummyApplicationDbContext();

            _loonkosten = dbContext.Loonkosten;
        }
 public GebruikerTest()
 {
     _context = new DummyApplicationDbContext();
 }
Example #21
0
 public StoreControllerTest()
 {
     _context           = new DummyApplicationDbContext();
     _productRepository = new Mock <IProductRepository>();
     _storeController   = new StoreController(_productRepository.Object);
 }
 public SessionTest()
 {
     _dummyApplicationContext = new DummyApplicationDbContext();
 }
Example #23
0
 public StoreControllerTest()
 {
     _dummyContext   = new DummyApplicationDbContext();
     _beerRepository = new Mock <IBeerRepository>();
     _controller     = new StoreController(_beerRepository.Object);
 }
Example #24
0
 public SessionTest()
 {
     this._dummyContext      = new DummyApplicationDbContext();
     this._sessionRepository = new Mock <IBoBSessionRepository>();
     this._controller        = new SessionController(_sessionRepository.Object);
 }
Example #25
0
 public CourseMaterialTest()
 {
     _dummyApplicationContext = new DummyApplicationDbContext();
 }
Example #26
0
 public VideoTest()
 {
     _dummyContext     = new DummyApplicationDbContext();
     this.VideoYoutube = _dummyContext.VideoYoutube;
     this.Video        = _dummyContext.Video;
 }
 public CommentTest()
 {
     _dummyApplicationContext = new DummyApplicationDbContext();
 }
Example #28
0
 public AfbeeldingTest()
 {
     _dummyContext   = new DummyApplicationDbContext();
     this.Afbeelding = _dummyContext.Afbeelding;
 }
 public AssignmentControllerTest()
 {
     _dummyContext = new DummyApplicationDbContext();
 }
Example #30
0
 public OrderTest()
 {
     dummyContext = new DummyApplicationDbContext();
     testOrder    = dummyContext.testOrder;
 }