public void GetAppliedTags_NullEntity_Exception()
        {
            var target = new AppliedTagService();

            ExceptionAssert.IsThrowing(new ArgumentNullException("entity"), () => {
                target.GetAppliedTags((IEntity <long>)null);
            });
        }
        public void GetAppliedTags_DoesNotExistsEntityWithName_Exception()
        {
            var target = new AppliedTagService();

            ExceptionAssert.IsThrowing(new ArgumentException("There is no entity with the name 'Jogo'."), () => {
                target.GetAppliedTags("Jogo", 1);
            });
        }
        public void InitializeTest()
        {
            Stubs.Initialize();
            Stubs.AppliedTagRepository.Add(new AppliedTag());
            Stubs.AppliedTagRepository.Add(new AppliedTag());
            Stubs.AppliedTagRepository.Add(new AppliedTag());
            Stubs.AppliedTagRepository.Add(new AppliedTag());
            Stubs.UnitOfWork.Commit();

            m_target = new AppliedTagService();
        }
        public void GetAppliedTags_NullEntityNameAndKey_Exception()
        {
            var target = new AppliedTagService();

            ExceptionAssert.IsThrowing(new ArgumentNullException("entityName"), () => {
                target.GetAppliedTags(null, 1);
            });

            ExceptionAssert.IsThrowing(new ArgumentNullException("entityName"), () => {
                target.GetAppliedTags("", 1);
            });
        }
        public void GetAppliedTags_NullOrEmptyEntityName_Exception()
        {
            var target = new AppliedTagService();

            ExceptionAssert.IsThrowing(new ArgumentNullException("entityName"), () => {
                target.GetAppliedTags((string)null);
            });

            ExceptionAssert.IsThrowing(new ArgumentNullException("entityName"), () => {
                target.GetAppliedTags("");
            });
        }
        public void Save_EntityDoesNotExists_Exception()
        {
            var appliedTag = new AppliedTag();

            appliedTag.EntityName = "Game";
            appliedTag.EntityKey  = 0;

            var target = new AppliedTagService();

            ExceptionAssert.IsThrowing(new SpecificationNotSatisfiedException("There is no Entity 'Game' with key '0'."), () => {
                target.SaveAppliedTag(appliedTag);
            });
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="jogosdaqui.WebApi.Controllers.AppliedTagsController"/> class.
 /// </summary>
 public AppliedTagsController()
 {
     m_service = new AppliedTagService();
 }
Exemplo n.º 8
0
        /// <summary>
        /// Gets the applied tags by entity name and key.
        /// </summary>
        /// <returns>The by entity.</returns>
        /// <param name="entityName">Entity name.</param>
        /// <param name="entityKey">Entity key.</param>
        public IEnumerable <AppliedTag> GetByEntity(string entityName, long entityKey)
        {
            var service = new AppliedTagService();

            return(service.GetAppliedTags(entityName, entityKey));
        }