Exemple #1
0
 public void Can_set_continuation()
 {
     Redirectable<Model> redirectable = new Redirectable<Model>();
     FubuContinuation continuation = FubuContinuation.RedirectTo(new Model());
     redirectable.Continuation = continuation;
     redirectable.Continuation.ShouldBeTheSameAs(continuation);
 }
Exemple #2
0
        public string ComputeTargetUrl(Redirectable redirectable)
        {
            if (redirectable is MicroUrl url)
            {
                return(url.Url);
            }

            if (redirectable is MicroText text)
            {
                return(_clientUrlService.ConstructEditorUrl(text.Key));
            }

            throw new ArgumentException(redirectable.GetType().FullName);
        }
Exemple #3
0
        public async Task <string> CreateAsync(Redirectable redirectable)
        {
            var storage      = _storageFactory.CreateStorage <MicroUrlEntity>();
            var entityToSave = _mapper.Map <MicroUrlEntity>(redirectable);
            var type         = redirectable.GetType();

            if (type == typeof(MicroText))
            {
                entityToSave.Type = MicroUrlEntity.TextType;
            }
            else if (type == typeof(MicroUrl))
            {
                entityToSave.Type = MicroUrlEntity.UrlType;
            }
            else
            {
                throw new ArgumentException(type.FullName);
            }

            entityToSave.Created = DateTime.Now;
            var key = await storage.CreateAsync(entityToSave);

            return(key.StringValue);
        }
Exemple #4
0
 public void Has_nextbehaviour_continuation_per_default()
 {
     Redirectable<Model> redirectable = new Redirectable<Model>();
     redirectable.Continuation.AssertWasContinuedToNextBehavior();
 }