예제 #1
0
        public void ItIsCreatedWithAnEmptySearchString()
        {
            var shoppingCart = new MultiSelectSearch(
                "Label",
                "Name",
                _searchService.Object,
                new ObservableCollection<ISearchablePromptItem>());

            Assert.AreEqual(string.Empty, shoppingCart.SearchString);
        }
예제 #2
0
        public void ItIsCreatedWithAnEmptySearchString()
        {
            var shoppingCart = new MultiSelectSearch(
                "Label",
                "Name",
                _searchService.Object,
                new ObservableCollection <ISearchablePromptItem>());

            Assert.AreEqual(string.Empty, shoppingCart.SearchString);
        }
예제 #3
0
        public void ItSetsTheAvailableItemsToTheSearchServiceGetAllWhenTheShoppingCartIsConstructed()
        {
            var expected = A.ObservableCollection(Mock.Of <ISearchablePromptItem>());

            _searchService
            .Setup(s => s.GetAll())
            .Returns(expected);

            var shoppingCart = new MultiSelectSearch(
                "label",
                "name",
                _searchService.Object,
                new ObservableCollection <ISearchablePromptItem>());

            Assert.AreEqual(expected, shoppingCart.AvailableItems);
        }
예제 #4
0
        public void ItUsesTheMultiSelectProviderWhenTheViewModelIsAMultiSelect()
        {
            var viewModel = new MultiSelectSearch(
                "name",
                "label",
                Mock.Of <ISearchService>(),
                new ObservableCollection <ISearchablePromptItem>());

            var expected = new UserControl();

            _multiSelectViewProvider.Setup(p => p.Get(viewModel)).Returns(expected);

            var actual = _provider.Get(viewModel);

            Assert.AreEqual(actual, expected);
        }
예제 #5
0
        public void ItSetsTheAvailableItemsToTheSearchServiceGetAllWhenTheShoppingCartIsConstructed()
        {
            var expected = A.ObservableCollection(Mock.Of<ISearchablePromptItem>());

            _searchService
                .Setup(s => s.GetAll())
                .Returns(expected);

            var shoppingCart = new MultiSelectSearch(
                "label",
                "name",
                _searchService.Object,
                new ObservableCollection<ISearchablePromptItem>());

            Assert.AreEqual(expected, shoppingCart.AvailableItems);
        }
예제 #6
0
        public void ItSetsTheAvailableItemsToTheResultOfTheSearchServiceWhenTheSearchCommandIsExecuted()
        {
            var expected = A.ObservableCollection(Mock.Of <ISearchablePromptItem>());

            const string searchString = "Search String";

            _searchService
            .Setup(s => s.Search(searchString))
            .Returns(expected);

            var shoppingCart = new MultiSelectSearch(
                "label",
                "name",
                _searchService.Object,
                new ObservableCollection <ISearchablePromptItem>());

            shoppingCart.SearchString = searchString;

            shoppingCart.Search.Execute(null);

            Assert.AreEqual(expected, shoppingCart.AvailableItems);
        }
예제 #7
0
        public void ItSetsTheAvailableItemsToTheResultOfTheSearchServiceWhenTheSearchCommandIsExecuted()
        {
            var expected = A.ObservableCollection(Mock.Of<ISearchablePromptItem>());

            const string searchString = "Search String";

            _searchService
                .Setup(s => s.Search(searchString))
                .Returns(expected);

            var shoppingCart= new MultiSelectSearch(
                "label",
                "name",
                _searchService.Object,
                new ObservableCollection<ISearchablePromptItem>());

            shoppingCart.SearchString = searchString;

            shoppingCart.Search.Execute(null);

            Assert.AreEqual(expected, shoppingCart.AvailableItems);
        }