コード例 #1
0
ファイル: LevelServiceUnitTest.cs プロジェクト: rqtx/cde
        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);
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public IEnumerable <Level> Get()
 {
     return(_service.GetAll());
 }
コード例 #4
0
        public override IHttpActionResult Get()
        {
            var companies = _service.GetAll();

            return(Ok(companies));
        }
 public IEnumerable <LevelViewModel> Get()
 {
     return(LevelService.GetAll());
 }