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); }
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 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 + "']")); } }
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 + "']")); } }