public GoogleSearchViewModelTest()
        {
            m_IWebCall        = new Mock <IWebCall>();
            m_ILogger         = new Mock <ILogger>();
            m_IJsonDataReader = new Mock <IJsonReader>();

            SearchCriteria objSearchCriteria = new SearchCriteria()
            {
                Url = "https://www.google.com.au"
                ,
                MaxResults = 10
                ,
                SearchKeywords = "conveyancing software"
                ,
                TermToAppear = "www.smokeball.com.au"
            };

            m_IWebCall.Setup(x => x.GetResultsAsync(objSearchCriteria)).ReturnsAsync(() => new List <string> {
                "www.smokeball.com.au", "www.leap.com.au"
            });

            m_IWebCall.Setup(x => x.GetLinkPositionsInResults(new List <string> {
                "www.smokeball.com.au", "www.leap.com.au"
            }, "www.smokeball.com.au")).Returns(new string("3,4"));

            m_IJsonDataReader.Setup(x => x.ReadParametersFromFile()).Returns(objSearchCriteria);
            //new SearchCriteria()
            //{
            //    Url = "https://www.google.com.au"
            //    ,MaxResults = 100
            //    ,SearchKeywords = "conveyancing software"
            //    ,TermToAppear = "www.smokeball.com.au"
            //});

            m_viewModel = new GoogleSearchViewModel(m_IWebCall.Object, m_ILogger.Object, m_IJsonDataReader.Object);
            ICommand ic = m_viewModel.GetCommand;

            ic.Execute(this);
        }
 public GoogleSearchView()
 {
     DataContext = new GoogleSearchViewModel();
     InitializeComponent();
 }
Example #3
0
 public GoogleSearchView(IWebCall p_webCall, ILogger p_Logger, IJsonReader p_JsonDataReader)
 {
     InitializeComponent();
     m__GoogleSearchViewModel = new GoogleSearchViewModel(p_webCall, p_Logger, p_JsonDataReader);
     DataContext = m__GoogleSearchViewModel;
 }