public ParserTest() { _contextFake = new ContextFake("ParserTest"); _context = _contextFake.GetContext("ParserTestingContext"); _repoP = new QuakePlayerRepo(_context); _repoG = new QuakeGameRepo(_context); _repoKM = new QuakeKillMethodRepo(_context); _parser = new Parser(_repoG, _repoP, _repoKM); }
public void GetEnvironments_ShouldWork() { var context = _contextFake.GetContext("GetEnvironments_ShouldWork") .AddFakeEnvironments(); var repo = new EnvironmentRepository(context); var controller = new EnvironmentController(repo, _mapper); var pageFilter = new PageFilter(); var result = controller.GetEnvironments(pageFilter); Assert.IsType <ActionResult <PageViewModel <EnvironmentViewModel> > >(result); var actionResult = Assert.IsType <OkObjectResult>(result.Result); Assert.IsType <PageViewModel <EnvironmentViewModel> >(actionResult.Value); }
public void AddLog_ShouldWork() { var log = new Log() { Title = "Removed BreakPoints", Origin = "7.41.110.164", Archived = false, LevelId = 1, EnvironmentId = 1, ApiUserId = 1 }; var context = _contextFake.GetContext("AddLog_ShouldWork") .AddFakeEnvironments() .AddFakeLevels() .AddFakeUsers(); var repo = new LogRepository(context); repo.Add(log); var result = context.Logs.FirstOrDefault(); Assert.NotNull(result); Assert.Equal(log, result, new LogComparer()); }
public QuakeGameLoggerControllerTest() { _contextFake = new ContextFake("QuakeGameLoggerControllerTest"); _context = _contextFake.GetContext("ControllerTestingContext"); _repoP = new QuakePlayerRepo(_context); _repoG = new QuakeGameRepo(_context); _repoKM = new QuakeKillMethodRepo(_context); _parser = new Parser(_repoG, _repoP, _repoKM); _parser.Reader(@"C:\Users\andre\source\repos\QuakeLoggerAPI\testRaw.txt"); var configuration = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperConfig()); }); _mapper = configuration.CreateMapper(); }
public void Add_ShouldWork() { var environment = new Environment() { Description = "Critical" }; var context = _contextFake.GetContext("Add_ShouldWork"); var repo = new EnvironmentRepository(context); repo.Add(environment); var result = context.Environments.FirstOrDefault(); Assert.NotNull(result); Assert.Equal(environment, result, new EnvironmentComparer()); }
public void Add_ShouldWork() { var level = new Level() { Description = "Critical" }; var context = _contextFake.GetContext("Add_ShouldWork"); var repo = new LevelRepository(context); repo.Add(level); var result = context.Levels.FirstOrDefault(); Assert.NotNull(result); Assert.Equal(level, result, new LevelComparer()); }
public void GetLogs_ShouldWork() { var context = _contextFake.GetContext("GetLogs_ShouldWork") .AddFakeEnvironments() .AddFakeLevels() .AddFakeUsers() .AddFakeLogs() .AddFakeEvents(); var repo = new LogRepository(context); var controller = new LogsController(repo, _mapper, _userManager); var pageFilter = new PageFilter(); var logFilter = new LogFilter(); var result = controller.GetLogs(pageFilter, logFilter, null); Assert.IsType <ActionResult <PageViewModel <LogItemPageViewModel> > >(result); var actionResult = Assert.IsType <OkObjectResult>(result.Result); Assert.IsType <PageViewModel <LogItemPageViewModel> >(actionResult.Value); }