Ejemplo n.º 1
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);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 4
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);
        }