Exemplo n.º 1
0
        public void AddTextureTest()
        {
            //Arrange
            SetUp();
            using (db = context.litedb)
            {
                TextureModel texture = new TextureModel()
                {
                    Name            = "Pink",
                    IsGrained       = false,
                    RealWorldHeight = 15,
                    RealWorldWidth  = 15
                };

                // Act
                repo.AddTexture(texture);

                // Assert
                Assert.AreEqual("Pink", genericRepo.GetById(texture.ID).Name);
                Assert.AreEqual(4, genericRepo.GetAll().Count());

                Console.WriteLine("ID: " + texture.ID + " Name: " + texture.Name +
                                  " Width: " + texture.RealWorldWidth + " Height: " + texture.RealWorldHeight);

                for (int i = 1; i <= genericRepo.GetAll().Count(); i++)
                {
                    Console.WriteLine("ID: " + genericRepo.GetById(i).ID + " Name: " + genericRepo.GetById(i).Name);
                }

                // Clean Up
                DeleteTextures();
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            var pais = new Paises {
                Nombre = "ezee", Habitantes = 3
            };

            _dbContext.Paises.Add(pais);
            _dbContext.SaveChanges();

            var obj = _dbContext.Paises.FirstOrDefault(x => x.Nombre == "ezee");

            var all = _genericRepo.GetAll();

            var paises = _genericRepo.GetById(obj.Id);

            var identity = (ClaimsIdentity)User.Identity;

            var claims = identity.Claims.First(x => x.Type == "name").Value;

            //HttpContext.Session.SetString("Test", "Ben Rules!");


            return(View(new ErrorViewModel {
                RequestId = claims
            }));
        }
        public KeywordEntityVM GetKeywordById(int id, int userId)
        {
            var result = new KeywordEntityVM();

            try
            {
                result = _mapper.Map <KeywordEntityVM>(_genericRepo.GetById(id));
                var mappedData = _mapper.Map <KeywordEntity_MapVM>(_keywordRepo.GetMappedKeywordLibrary(id, userId));
                if (mappedData != null)
                {
                    result = _mapper.Map <KeywordEntityVM>(mappedData);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }
            return(result);
        }
Exemplo n.º 4
0
        public TestControllerVM GetController2ById(int id, int userId)
        {
            var result = new TestControllerVM();

            try
            {
                var data = _genericRepo2.GetById(id);
                result = _mapper.Map <TestControllerVM>(data);
                var mappedData = _mapper.Map <TestController_MapVM>(_testControllerRepo.GetMappedTestControllerData(userId, data, id));
                if (mappedData != null)
                {
                    result = _mapper.Map <TestControllerVM>(mappedData);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }
            return(result);
        }
        public TestScriptVM Get(int id, int userId)
        {
            var result = new TestScriptVM();

            try
            {
                result = _mapper.Map <TestScriptVM>(_genericRepo.GetById(id));
                var mappedData = _mapper.Map <TestScript_MapVM>(_testScriptsRepo.GetMappedTestScript(id, userId));
                if (mappedData != null)
                {
                    result = _mapper.Map <TestScriptVM>(mappedData);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }

            return(result);
        }
Exemplo n.º 6
0
        public RepositoryEntityVM GetRepositoryById(int id, int userId)
        {
            var result = new RepositoryEntityVM();

            try
            {
                var data = _genericRepo.GetById(id);
                if (data != null)
                {
                    data.IsLocked     = true;
                    data.LockedByUser = userId;
                    data.UserId       = userId;
                    _repositoryEntityRepo.UpdateLockedByFlags(data);
                }
                result = _mapper.Map <RepositoryEntityVM>(data);
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }
            return(result);
        }
Exemplo n.º 7
0
        public BrowserControllerVM GetController3ById(int id)
        {
            var result = new BrowserControllerVM();

            try
            {
                result = _mapper.Map <BrowserControllerVM>(_genericRepo3.GetById(id));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Source: {ex.Source}, StackTrace: {ex.StackTrace} ,  Message: {ex.Message}");
            }
            return(result);
        }
Exemplo n.º 8
0
 public T GetById(int id)
 {
     return(genericRepo.GetById(id));
 }
Exemplo n.º 9
0
        public TextureModel GetTextureById(int id)
        {
            var texture = genericRepo.GetById(id);

            return(texture);
        }