public void TearDown()
    {
      this.testData = null;

      this.session.Dispose();
      this.session = null;
    }
 public void Setup()
 {
   this.testData = TestEnvironment.DefaultTestEnvironment();
   this.session = SitecoreWebApiSessionBuilder.AuthenticatedSessionWithHost(this.testData.InstanceUrl)
     .Credentials(this.testData.Users.Admin)
     .BuildReadonlySession();
 }
 public void TearDown()
 {
   this.itemSource = null;
   this.session.Dispose();
   this.session = null;
   this.env = null;
   this.mediaSettings = null;
 }
    public void SetupSession()
    {
      this.testData = TestEnvironment.DefaultTestEnvironment();
      this.session = this.CreateSession();

      // Same as this.session
      var cleanupSession = this.CreateSession();
      this.noThrowCleanupSession = new NoThrowWebApiSession(cleanupSession);
    }
 public void TearDown()
 {
   using (new FunctionTracer("CancelOperationsTest->tearDown()", DebugWriteLineBlock))
   {
     this.testData = null;
     this.session.Dispose();
     this.session = null;
   }
 }
 public void TearDown()
 {
   this.anonymousSession.Dispose();
   this.anonymousSession = null;
   this.authenticatedSession.Dispose();
   this.authenticatedSession = null;
   this.mediaSettings = null;
   this.testData = null;
 }
    public void TearDown()
    {
      this.testData = null;

      this.session.Dispose();
      this.session = null;

      this.noThrowCleanupSession.Dispose();
      this.noThrowCleanupSession = null;
    }
    public void Setup()
    {
      this.testData = TestEnvironment.DefaultTestEnvironment();

      var builder = new ReadItemByIdRequestBuilder(this.testData.Items.ItemWithVersions.Id).Payload(PayloadType.Content);
      this.requestWithVersionsItemId = builder.Build();

      homeItemRequestBuilder = new ReadItemByIdRequestBuilder(this.testData.Items.Home.Id);
      homeItemRequestBuilder.Payload(PayloadType.Content);
    }
    public void Setup()
    {
      using (new FunctionTracer("CancelOperationsTest->setup()", DebugWriteLineBlock))
      {
        this.testData = TestEnvironment.DefaultTestEnvironment();

        this.session =
          SitecoreWebApiSessionBuilder.AuthenticatedSessionWithHost(this.testData.InstanceUrl)
            .Credentials(this.testData.Users.Admin)
            .BuildReadonlySession();
      }
    }
    public void Setup()
    {
      this.testData = TestEnvironment.DefaultTestEnvironment();

      this.sessionAuthenticatedUser =
        SitecoreWebApiSessionBuilder.AuthenticatedSessionWithHost(testData.InstanceUrl)
          .Credentials(testData.Users.Admin)
          .DefaultDatabase("web")
          .DefaultLanguage("en")
          .BuildReadonlySession();

      this.requestWithItemId = ItemWebApiRequestBuilder.ReadItemsRequestWithId(testData.Items.ItemWithVersions.Id)
        .Payload(PayloadType.Content)
        .Build();
    }
    public void SetUp()
    {
      this.mediaSettings = new MediaLibrarySettings(
        "/sitecore/media library",
        "ashx",
        "~/media/");

      this.testData = TestEnvironment.DefaultTestEnvironment();

      var config = new SessionConfig(testData.InstanceUrl);
      this.anonymousSession = new ScTestApiSession(config, null, this.mediaSettings, LegacyConstants.DefaultSource());

      config = new SessionConfig(testData.InstanceUrl);
      this.authenticatedSession = new ScTestApiSession(config, testData.Users.Admin, this.mediaSettings, LegacyConstants.DefaultSource());
    }
    public void Setup()
    {
      this.testData = TestEnvironment.DefaultTestEnvironment();

      if (!this.testData.IsMediaHashesSupported)
      {
        Assert.Ignore();
      }

      this.session =
        SitecoreWebApiSessionBuilder.AuthenticatedSessionWithHost(this.testData.InstanceUrl)
          .Credentials(this.testData.Users.Admin)
          .MediaResizingStrategy(DownloadStrategy.Hashed)
          .BuildReadonlySession();
    }
    public static TestEnvironment DefaultTestEnvironment()
    {
      var result = new TestEnvironment
      {
        IsMediaHashesSupported = TestEndpointsConfig.IsMediaHashesSupported,
        InstanceUrl = TestEndpointsConfig.InstanceUrl,

        ShellSite = "/sitecore/shell"
      };

      result.Items.Home.Id = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}";
      result.Items.Home.Path = "/sitecore/content/Home";
      result.Items.Home.DisplayName = "Home";
      result.Items.Home.Template = "Sample/Sample Item";
      result.Items.Home.TemplateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}";

      result.Items.ItemWithVersions.Id = "{B86C2CBB-7808-4798-A461-1FB3EB0A43E5}";
      result.Items.ItemWithVersions.Path = "/sitecore/content/FieldsTest/TestFieldsVersionsAndDB";
      result.Items.ItemWithVersions.DisplayName = "TestFieldsVersionsAndDB";

      result.Items.TestFieldsItem.Id = "{00CB2AC4-70DB-482C-85B4-B1F3A4CFE643}";
      result.Items.TestFieldsItem.Path = "/sitecore/content/Home/Test Fields";
      result.Items.TestFieldsItem.DisplayName = "Test Fields";
      result.Items.TestFieldsItem.Template = "Test Templates/Sample fields";
      result.Items.TestFieldsItem.TemplateId = "{5FC0D542-E27B-4E55-A1F0-702E959DCD6C}";

      result.Items.AllowedItem.Id = "{387B69B2-B2EA-4618-8C3E-2785DC0469A7}";
      result.Items.AllowedItem.Path = "/sitecore/content/Home/Allowed_Parent/Allowed_Item";
      result.Items.AllowedItem.DisplayName = "Allowed_Item";

      result.Items.AllowedParent.Id = "{2075CBFF-C330-434D-9E1B-937782E0DE49}";
      result.Items.AllowedParent.Path = "/sitecore/content/Home/Allowed_Parent";
      result.Items.AllowedParent.DisplayName = "Allowed_Parent";

      result.Items.CreateItemsHere.Id = "{C50613DC-D792-467C-832F-F93BB121D775}";
      result.Items.CreateItemsHere.Path = "/sitecore/content/Home/Android/Folder for create items";
      result.Items.CreateItemsHere.DisplayName = "Folder for create items";

      result.Items.MediaImagesItem.Id = "{15451229-7534-44EF-815D-D93D6170BFCB}";
      result.Items.MediaImagesItem.Path = "/sitecore/media library/Images";
      result.Items.MediaImagesItem.Template = "/sitecore/templates/System/Media/Media folder";
      result.Items.MediaImagesItem.TemplateId = "{FE5DD826-48C6-436D-B87A-7C4210C7413B}";

      result.Items.UploadMediaHere.Id = "{EFBA81CC-69A3-4E32-BADB-379B6C347437}";
      result.Items.UploadMediaHere.Path = "/Test Data/Create Edit Delete Media";

      return result;
    }
    public void Setup()
    {
      TestEnvironment env = TestEnvironment.DefaultTestEnvironment();
      this.env = env;

      this.mediaSettings = new MediaLibrarySettings(
        "/sitecore/media library",
        "ashx",
        "~/media/");

      var connection = new SessionConfig(this.env.InstanceUrl);
      var defaultSource = LegacyConstants.DefaultSource();

      this.session = new ScTestApiSession(connection, env.Users.Admin, this.mediaSettings, defaultSource);
      this.itemSource = new MutableItemSource("master", "en", 3872);
    }
 public void TearDown()
 {
   this.testData = null;
 }
 public void Setup()
 {
   testData = TestEnvironment.DefaultTestEnvironment();
 }
 public void Setup()
 {
   testData = TestEnvironment.DefaultTestEnvironment();
   this.requestWithItemId = ItemWebApiRequestBuilder.ReadItemsRequestWithId(this.testData.Items.Home.Id).Build();
 }
 public void TearDown()
 {
   this.sessionAuthenticatedUser.Dispose();
   this.sessionAuthenticatedUser = null;
   this.testData = null;
 }
    private async void GetAndCheckItem(TestEnvironment.Item expectedItem, ISitecoreItem resultItem)
    {
      var readResponse = await this.GetItemById(resultItem.Id);

      this.testData.AssertItemsCount(1, readResponse);
      this.testData.AssertItemsAreEqual(expectedItem, readResponse[0]);
    }
    private ISitecoreItem CheckCreatedItem(ScItemsResponse createResponse, TestEnvironment.Item expectedItem)
    {
      this.testData.AssertItemsCount(1, createResponse);
      ISitecoreItem resultItem = createResponse[0];
      this.testData.AssertItemsAreEqual(expectedItem, resultItem);

      return resultItem;
    }