コード例 #1
0
        public void AddNewMadbestillingToDatabase()
        {
            IMadbestillingRepository testRepo = DataTestService.GetInMemoryRepo();

            var madbestillings = new Madbestillings()
            {
                MenuTekst         = "Burger",
                AntalBestillinger = 1
            };


            testRepo.Save(madbestillings);


            Assert.Single(testRepo.Get());
            Assert.Equal(madbestillings.MenuTekst, testRepo.Get(1).MenuTekst);
        }
コード例 #2
0
        public void DeleteMadbestillingFromDatabase()
        {
            IMadbestillingRepository testrepo = DataTestService.GetInMemoryRepo();

            var madbestillings = new Madbestillings()
            {
                MenuTekst         = "Burger",
                AntalBestillinger = 1
            };

            testrepo.Save(madbestillings);


            testrepo.Delete(testrepo.Get(1).MadbestillingId);


            Assert.Empty(testrepo.Get());
        }
コード例 #3
0
        public void MadbestillingWithSameIDOverWritesCurrentMadbestillingInDB()
        {
            IMadbestillingRepository testrepo = DataTestService.GetInMemoryRepo();

            var madbestillings = new Madbestillings()
            {
                MenuTekst         = "Burger",
                AntalBestillinger = 1
            };

            testrepo.Save(madbestillings);

            var sameMadbestilling = testrepo.Get(1);

            sameMadbestilling.MenuTekst = "Burger2";


            testrepo.Save(sameMadbestilling);


            Assert.Single(testrepo.Get());
            Assert.Equal(sameMadbestilling.MenuTekst, testrepo.Get(1).MenuTekst);
        }
コード例 #4
0
 public MadbestillingsController(IMadbestillingRepository madbestillingRepo, IMadmenuRepository madmenuRepo)
 {
     this.madbestillingRepository = madbestillingRepo;
     this.madmenuRepository       = madmenuRepo;
 }