public void SetUp ()
        {
            ServiceContainer.Register<ISynchronizeInvoke> (() => new Mocks.MockSynchronizeInvoke ());
            ServiceContainer.Register<IAssignmentService> (() => new Mocks.MockAssignmentService ());

            viewModel = new HistoryViewModel ();
        }
		public SummaryHistoryActivity ()
		{
			historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();
			itemViewModel = ServiceContainer.Resolve<ItemViewModel> ();
			laborViewModel = ServiceContainer.Resolve<LaborViewModel> ();
			photoViewModel = ServiceContainer.Resolve<PhotoViewModel> ();
			expenseViewModel = ServiceContainer.Resolve<ExpenseViewModel> ();
			documentViewModel = ServiceContainer.Resolve<DocumentViewModel> ();
			menuViewModel = ServiceContainer.Resolve<MenuViewModel> ();

			assignmentHistory = historyViewModel.SelectedAssignmentHistory;
		}
		public HistoryController (IntPtr handle) : base (handle)
		{
			historyViewModel = ServiceContainer.Resolve<HistoryViewModel>();
			assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();
		}
			public TableSource (HistoryController controller)
			{
				this.controller = controller;
				historyViewModel = ServiceContainer.Resolve<HistoryViewModel>();
				assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();
			}
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);

            historyViewModel = ServiceContainer.Resolve<HistoryViewModel> ();
            menuViewModel = ServiceContainer.Resolve<MenuViewModel> ();

            var view = inflater.Inflate (Resource.Layout.HistoryFragmentLayout, null, true);

            searchText = view.FindViewById<EditText> (Resource.Id.historySearchText);
            searchText.TextChanged += (sender, e) => {
                if (historySearchAdapter != null) {
                    historySearchAdapter.FilterItems (searchText.Text);
                    historySearchAdapter.NotifyDataSetChanged ();
                }
            };
            var clearSearch = view.FindViewById<ImageButton> (Resource.Id.historyClearSearch);
            clearSearch.Click += (sender, e) => searchText.Text = string.Empty;

            tabHost = view.FindViewById<TabHost> (Resource.Id.historyTabHost);
            historyListView = view.FindViewById<ListView> (Resource.Id.historyListView);

            localManger = new LocalActivityManager (Activity, true);
            localManger.DispatchCreate (savedInstanceState);
            tabHost.Setup (localManger);

            var dateIndicator = CreateTab ("DATE");
            TabHost.TabSpec dateTab = tabHost.NewTabSpec ("Date");
            dateTab.SetIndicator (dateIndicator);
            dateTab.SetContent (new TabContent (new TextView (tabHost.Context)));

            var callsIndicator = CreateTab ("CALLS");
            TabHost.TabSpec callsTab = tabHost.NewTabSpec ("Calls");
            callsTab.SetIndicator (callsIndicator);
            callsTab.SetContent (new TabContent(new TextView(tabHost.Context)));

            var assignmentIndicator = CreateTab ("ASSIGNMENTS");
            TabHost.TabSpec assignments = tabHost.NewTabSpec ("Assignments");
            assignments.SetIndicator (assignmentIndicator);
            assignments.SetContent (new TabContent (new TextView(tabHost.Context)));

            tabHost.AddTab (dateTab);
            tabHost.AddTab (callsTab);
            tabHost.AddTab (assignments);

            tabHost.TabChanged += (sender, e) => {
                if (History != null) {
                    switch (tabHost.CurrentTab) {
                        case 0:
                            historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.OrderBy (h => h.Date).ToList ());
                            break;
                        case 1:
                            historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.Where (h => h.Type == AssignmentHistoryType.PhoneCall).ToList ());
                            break;
                        default:
                            historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.Where (h => h.Type == AssignmentHistoryType.Assignment).ToList ());
                            break;
                    }
                    historySearchAdapter.Assignment = Assignment;
                    historyListView.Adapter = historySearchAdapter; 
                }
            };
            if (History != null) {
                historySearchAdapter = new HistoryListAdapter (Activity, Resource.Layout.HistoryItemLayout, History.OrderBy (a => a.Date).ToList ());
                historySearchAdapter.Assignment = Assignment;
                historyListView.Adapter = historySearchAdapter;
            }

            historyListView.ItemClick += (sender, e) => {
                var intent = new Intent (Activity, typeof (SummaryHistoryActivity));
                historyViewModel.SelectedAssignmentHistory = History.ElementAtOrDefault (e.Position);
                menuViewModel.MenuIndex = 0;
                StartActivity (intent);
            };

            return view;
        }