public void GetAllUserTest() { var fakeContext = new FakeContext(); fakeContext.FillWith <LevelModel>(); using (ApplicationDbContext dbContext = new ApplicationDbContext(fakeContext.FakeOptions)) { var service = new LevelService(dbContext); var expected = fakeContext.GetFakeData <LevelModel>(); var result = service.GetAll().ToList(); result.Should().BeEquivalentTo(expected); } }
public void Should_Return_All_Levels() { var fakeContext = new FakeContext("GetAllLevels"); fakeContext.FillWith <Level>(); using (var context = new MainContext(fakeContext.FakeOptions)) { var levelCountIndDb = context.Level.Count(); var repository = new LevelRepository(context); var validator = new LevelValidator(); var service = new LevelService(repository, validator); Assert.Equal(levelCountIndDb, service.GetAll().Count()); repository.Dispose(); } }
public IEnumerable <Level> Get() { return(_service.GetAll()); }
public override IHttpActionResult Get() { var companies = _service.GetAll(); return(Ok(companies)); }
public IEnumerable <LevelViewModel> Get() { return(LevelService.GetAll()); }