public void AutocompleteStoreDeleteErrorTest()
        {
            // Arrange
            var context = new IndexStoreTestContext();
            var webException = context.GetWebException("Test Error", "TestErrorResponse", HttpStatusCode.NotFound);

            var mockRequestFactory = context.GetErrorRequestFactory(webException);
            var autocompleteStore = context.StoreFactory.GetStore<AutocompleteEntity>() as IndexStore<AutocompleteEntity>;
            autocompleteStore.RequestFactory = mockRequestFactory.Object;

            // Act
            var exception = Assert.Throws<ServiceException>(() => autocompleteStore.Delete("testId"));

            // Assert
            Assert.Equal("Test Error"+Environment.NewLine+"TestErrorResponse", exception.Message);
        }
Esempio n. 2
0
        public void AutocompleteStoreGetByIdErrorTest()
        {
            // Arrange
            var context      = new IndexStoreTestContext();
            var webException = context.GetWebException("Test Error", "TestErrorResponse", HttpStatusCode.NotFound);

            var mockRequestFactory = context.GetErrorRequestFactory(webException);
            var autocompleteStore  = context.StoreFactory.GetStore <AutocompleteEntity>() as IndexStore <AutocompleteEntity>;

            autocompleteStore.RequestFactory = mockRequestFactory.Object;

            // Act
            var result = autocompleteStore.Get("testId");

            // Assert
            Assert.Null(result);
        }
Esempio n. 3
0
        public void AutocompleteStoreDeleteErrorTest()
        {
            // Arrange
            var context      = new IndexStoreTestContext();
            var webException = context.GetWebException("Test Error", "TestErrorResponse", HttpStatusCode.NotFound);

            var mockRequestFactory = context.GetErrorRequestFactory(webException);
            var autocompleteStore  = context.StoreFactory.GetStore <AutocompleteEntity>() as IndexStore <AutocompleteEntity>;

            autocompleteStore.RequestFactory = mockRequestFactory.Object;

            // Act
            var exception = Assert.Throws <ServiceException>(() => autocompleteStore.Delete("testId"));

            // Assert
            Assert.Equal("Test Error" + Environment.NewLine + "TestErrorResponse", exception.Message);
        }
        public void AutocompleteStoreGetByIdErrorTest()
        {
            // Arrange
            var context = new IndexStoreTestContext();
            var webException = context.GetWebException("Test Error", "TestErrorResponse", HttpStatusCode.NotFound);

            var mockRequestFactory = context.GetErrorRequestFactory(webException);
            var autocompleteStore = context.StoreFactory.GetStore<AutocompleteEntity>() as IndexStore<AutocompleteEntity>;
            autocompleteStore.RequestFactory = mockRequestFactory.Object;

            // Act
            var result =  autocompleteStore.Get("testId");

            // Assert
            Assert.Null(result);
        }