public async Task HentBestillingerIkkeOK() { mockRep.Setup(s => s.HentBestillinger(It.IsAny <int>())).ReturnsAsync(It.IsAny <List <Bestillinger> >); var BestillingController = new BestillingController(mockRep.Object, mockLog.Object); var resultat = await BestillingController.HentBestillinger(It.IsAny <int>()) as NotFoundObjectResult; //Assert Assert.Equal((int)HttpStatusCode.NotFound, resultat.StatusCode); Assert.Equal("Ingen bestillinger funnet", resultat.Value); }
public async Task HentBestillingerOK() { Bestillinger bestilling = new Bestillinger { Id = 1, Antall = 5, Avgang = It.IsAny <Avganger>(), Bruker = It.IsAny <Brukere>() }; List <Bestillinger> bestillingListe = new List <Bestillinger> { bestilling }; mockRep.Setup(s => s.HentBestillinger(It.IsAny <int>())).ReturnsAsync(bestillingListe); var BestillingController = new BestillingController(mockRep.Object, mockLog.Object); var resultat = await BestillingController.HentBestillinger(It.IsAny <int>()) as OkObjectResult; //Assert Assert.Equal((int)HttpStatusCode.OK, resultat.StatusCode); Assert.Equal <List <Bestillinger> >((List <Bestillinger>)resultat.Value, bestillingListe); }