public void Can_set_continuation() { Redirectable<Model> redirectable = new Redirectable<Model>(); FubuContinuation continuation = FubuContinuation.RedirectTo(new Model()); redirectable.Continuation = continuation; redirectable.Continuation.ShouldBeTheSameAs(continuation); }
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); }
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); }
public void Has_nextbehaviour_continuation_per_default() { Redirectable<Model> redirectable = new Redirectable<Model>(); redirectable.Continuation.AssertWasContinuedToNextBehavior(); }