コード例 #1
0
        public void Setup()
        {
            this.testData = TestEnvironment.DefaultTestEnvironment();

            var builder = new ReadItemByIdRequestBuilder(this.testData.Items.ItemWithVersions.Id);

            this.requestWithVersionsItemId = builder.Build();

            homeItemRequestBuilder = new ReadItemByIdRequestBuilder(this.testData.Items.Home.Id);
        }
コード例 #2
0
    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);
    }
コード例 #3
0
        public async void TestGetItemWithNotExistedDbReturnsException()
        {
            const string Database       = "new_database";
            var          requestBuilder = new ReadItemByIdRequestBuilder(testData.Items.Home.Id).Database(Database);

            using
            (
                var session = this.CreateAdminSession()
            )
            {
                var response = await GetItemByIdWithRequestBuilder(requestBuilder, session);

                testData.AssertItemsCount(0, response);
            }
        }
        public void TestGetItemWithNotExistedDbReturnsException()
        {
            const string Database       = "new_database";
            var          requestBuilder = new ReadItemByIdRequestBuilder(testData.Items.Home.Id).Database(Database);

            using
            (
                var session = this.CreateAdminSession()
            )
            {
                TestDelegate testCode = async() =>
                {
                    var   task = GetItemByIdWithRequestBuilder(requestBuilder, session);
                    await task;
                };
                Exception exception = Assert.Throws <ParserException>(testCode);


                Assert.AreEqual("[Sitecore Mobile SDK] Data from the internet has unexpected format", exception.Message);
                Assert.AreEqual("Sitecore.MobileSDK.API.Exceptions.WebApiJsonErrorException", exception.InnerException.GetType().ToString());
                Assert.True(exception.InnerException.Message.Contains("Could not find configuration node: databases/database[@id='" + Database + "']"));
            }
        }
コード例 #5
0
    public void TestGetItemWithNotExistedDbReturnsException()
    {
      const string Database = "new_database";
      var requestBuilder = new ReadItemByIdRequestBuilder(testData.Items.Home.Id).Database(Database);
      using
      (
        var session = this.CreateAdminSession()
      )
      {
        TestDelegate testCode = async () =>
        {
          var task = GetItemByIdWithRequestBuilder(requestBuilder, session);
          await task;
        };
        Exception exception = Assert.Throws<ParserException>(testCode);


        Assert.AreEqual("[Sitecore Mobile SDK] Data from the internet has unexpected format", exception.Message);
        Assert.AreEqual("Sitecore.MobileSDK.API.Exceptions.WebApiJsonErrorException", exception.InnerException.GetType().ToString());
        Assert.True(exception.InnerException.Message.Contains("Could not find configuration node: databases/database[@id='" + Database + "']"));
      }
    }