Exemplo n.º 1
0
        public void TestFilterOutOfBounds()
        {
            var watchRepo            = new Mock <IWatchesRepository>();
            IWatchesServices service = new WatchesService(watchRepo.Object);
            Exception        ex      = Assert.Throws <InvalidDataException>(() => service.GetFilteredWatches(new Filter()
            {
                CurrentPage = 10, ItemsPerPage = 10
            }));

            Assert.Equal("Index out of bounds, Curret page is too high", ex.Message);
        }
Exemplo n.º 2
0
        public void TestFilterInvalidData()
        {
            var watchRepo            = new Mock <IWatchesRepository>();
            IWatchesServices service = new WatchesService(watchRepo.Object);
            Exception        ex      = Assert.Throws <InvalidDataException>(() => service.GetFilteredWatches(new Filter()
            {
                CurrentPage = 0, ItemsPerPage = 0
            }));

            Assert.Equal("Current page and Items per page must be above zero", ex.Message);
        }