public void IsValidForRequest_GetRequest_ShouldReturnTrue(ValidateRenderingIdAttribute attribute, ControllerContext ctx)
 {
   InitControllerContext(ctx);
   ctx.HttpContext.Request.HttpMethod.Returns("get");
   //act and assert
   attribute.IsValidForRequest(ctx, null).Should().BeTrue();
 }
 public void IsValidForRequest_WffmForm_ShouldReturnFalse(ValidateRenderingIdAttribute attribute, ControllerContext ctx, string id)
 {
   InitControllerContext(ctx);
   ctx.HttpContext.Request.Form.Add($"wffm{Guid.NewGuid()}.FormId",id);
   //act and assert
   attribute.IsValidForRequest(ctx, null).Should().BeFalse();
 }
    public void IsValidForRequest_CurrentRenderingNull_ShouldReturnFalse(ValidateRenderingIdAttribute attribute, ControllerContext ctx, string id)
    {
      InitControllerContext(ctx);
      ctx.HttpContext.Request.Form.Add("uid", id);

      //act and assert
      attribute.IsValidForRequest(ctx, null).Should().BeFalse();
    }
    public void IsValidForRequest_CurrentRenderingIDNotMatch_ShouldReturnFalse(ValidateRenderingIdAttribute attribute, ControllerContext controllerContext, Guid formId, Guid id)
    {
      //arrange
      InitControllerContext(controllerContext);
      controllerContext.HttpContext.Request.Form.Add("uid", formId.ToString());
      ContextService.Get().Push(new RenderingContext
      {
        Rendering = new Rendering
        {
          UniqueId = id
        }
      });

      //act and assert
      attribute.IsValidForRequest(controllerContext, null).Should().BeFalse();
    }
 public void IsValidForRequest_FormWithoutRenderingId_ShouldReturnTrue(ValidateRenderingIdAttribute attribute, ControllerContext controllerContext, string formId, Guid id)
 {
   //arrange
   InitControllerContext(controllerContext);
   //act and assert
   attribute.IsValidForRequest(controllerContext, null).Should().BeTrue();
 }