Example #1
0
        public void Test_Verificar_Llamado_Metodo_GetById_Del_Repositorio()
        {
            this.successStoryRepository.Setup(it => it.GetById(It.IsAny <int>(), It.IsAny <int>())).Verifiable();
            SuccessStoryList actual = this.successStoryBussiness.GetById(0, 0);

            this.successStoryRepository.Verify(it => it.GetById(It.IsAny <int>(), It.IsAny <int>()));
        }
Example #2
0
        public void Test_Consultar_Todas_Los_CasosExito_Validar_Que_Sean_Las_Esperadas()
        {
            SuccessStoryList expected = new SuccessStoryList();

            this.successStoryRepository.Setup(it => it.GetById(It.IsAny <int>(), It.IsAny <int>())).Returns(expected);
            SuccessStoryList actual = this.successStoryBussiness.GetById(0, 0);

            Assert.AreSame(expected, actual);
        }
Example #3
0
        public void Test_Consultar_Todos_Los_CasosExito_Retorna_Registros()
        {
            SuccessStoryList expected = new SuccessStoryList();

            this.successStoryRepository.Setup(it => it.GetById(It.IsAny <int>(), It.IsAny <int>())).Returns(expected);
            SuccessStoryList actual = this.successStoryBussiness.GetById(1, 1);

            Assert.AreEqual(expected, actual);
        }
Example #4
0
        /// <summary>
        /// Consulta el caso de exito deseado.
        /// </summary>
        /// <param name="id">Id del caso</param>
        /// <param name="languageId">Id del lenguaje.</param>
        /// <returns>Caso de exito.</returns>
        public SuccessStoryList GetById(int id, int?languageId)
        {
            Database dataBase = DatabaseFactory.CreateDatabase(CONNECTION_NAME);

            SuccessStoryList story = new SuccessStoryList();

            DbCommand dbCommand = dataBase.GetStoredProcCommand(CTSUCCESSSTORYFRONTENDBYID);

            dataBase.AddInParameter(dbCommand, "@ContentId", System.Data.DbType.Int32, id);
            dataBase.AddInParameter(dbCommand, "@LanguageId", System.Data.DbType.Int32, languageId);

            using (IDataReader dataReader = dataBase.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    story = new SuccessStoryList(dataReader);
                }
            }

            return(story);
        }