コード例 #1
0
    public void TestCopyIsIndependent()
    {
      DownloadMediaOptions options = new DownloadMediaOptions();
      options.SetWidth(100);
      options.SetScale(1.5f);

      DownloadMediaOptions copy = (DownloadMediaOptions)options.DeepCopyMediaDownloadOptions();

      options.SetWidth(200);

      Assert.AreEqual("100", copy.Width);
      Assert.AreEqual("1.5", copy.Scale);
    }
コード例 #2
0
    public void CorrectDownloadOptionsWithAllParamsTest()
    {
      var options = new DownloadMediaOptions();
      options.SetWidth(10);
      options.SetHeight(10);
      options.SetBackgroundColor("3F0000");
      options.SetAllowStrech(false);
      options.SetDisableMediaCache(false);
      options.SetDisplayAsThumbnail(true);
      options.SetMaxHeight(10);
      options.SetMaxWidth(10);
      options.SetScale(2.5f);

      string result = this.builder.BuildUrlStringForPath("~/media/1.png", options);
      const string expected = "http://test.host/~/media/1.png?w=10&h=10&mw=10&mh=10&bc=3f0000&dmc=0&as=0&sc=2.5&thn=1&db=web&la=en";

      Assert.AreEqual(expected, result);
    }
コード例 #3
0
    public void CorrectDownloadOptionsWithNullValuesTest()
    {
      var options = new DownloadMediaOptions();
      options.SetWidth(100);
      options.SetBackgroundColor("white");
      options.SetBackgroundColor(null);

      options.SetDisplayAsThumbnail(true);
      options.SetDisplayAsThumbnail(false);

      string result = this.builder.BuildUrlStringForPath("~/media/1", options);
      const string expected = "http://test.host/~/media/1.ashx?w=100&thn=0&db=web&la=en";

      Assert.AreEqual(expected, result);
    }