public async Task LoadPollAsync()
		{
			// Arrange
			var viewModel = GetViewModel();

			var random = new Random();

			var principal = new PrincipalMock();

			var identity = new UserIdentityMock();
			identity.UserID = random.Next();
			principal.Identity = identity;

			Csla.ApplicationContext.User = principal;

			var pollId = random.Next();

			viewModel.Parameter = Serializer.Serialize(
				new ViewPollPageNavigationCriteria { PollId = pollId });

			var pollSubmission = new PollSubmissionMock();
			IPollSubmissionCommand actualCommand = null;
			ObjectFactory.CreateAsyncDelegate = () => new PollSubmissionCommandMock();
			ObjectFactory.ExecuteAsyncDelegate = (command) =>
				{
					actualCommand = command;
					return new PollSubmissionCommandMock { Submission = pollSubmission };
				};

			var didNavigate = false;
			Navigation.NavigateToViewModelWithParameterDelegate = ((type, param) =>
			{
				didNavigate = true;
			});

			// Act
			await viewModel.LoadPollAsync();

			// Assert
			Assert.IsFalse(didNavigate, "Did Navigate");
			Assert.AreEqual(identity.UserID, actualCommand.UserID, "UserID");
			Assert.AreEqual(pollId, actualCommand.PollID, "PollID");
		}
		public async Task LoadPollAsyncWithError()
		{
			// Arrange
			var viewModel = GetViewModel();

			var random = new Random();

			var principal = new PrincipalMock();

			var identity = new UserIdentityMock();
			identity.UserID = random.Next();
			principal.Identity = identity;

			Csla.ApplicationContext.User = principal;

			var pollId = random.Next();

			viewModel.Parameter = Serializer.Serialize(
				new ViewPollPageNavigationCriteria { PollId = pollId });

			ObjectFactory.CreateAsyncDelegate = () => new PollSubmissionCommandMock();
			ObjectFactory.ExecuteAsyncDelegate = (command) =>
			{
				throw new DataPortalException(null, command);
			};

			var wasMessageBoxShown = false;
			MessageBox.ShowAsyncWithTitleDelegate = (message, title, buttons) =>
				{
					wasMessageBoxShown = true;
					return true;
				};

			// Act
			await viewModel.LoadPollAsync();

			// Assert
			Assert.IsTrue(wasMessageBoxShown, "Was Message Box Shown");
		}
		public async Task SharePoll()
		{
			// Arrange
			var viewModel = GetViewModel();

			var random = new Random();

			var principal = new PrincipalMock();

			var identity = new UserIdentityMock();
			identity.UserID = random.Next();
			principal.Identity = identity;

			Csla.ApplicationContext.User = principal;

			var pollId = random.Next();
			var pollSubmission = new PollSubmissionMock
			{
				PollID = pollId
			};
			
			ObjectFactory.CreateAsyncDelegate = () => new PollSubmissionCommandMock();
			ObjectFactory.ExecuteAsyncDelegate = (command) =>
			{
				return new PollSubmissionCommandMock { Submission = pollSubmission };
			};

			var wasShareManagerInitialized = false;
			ShareManager.InitializeDelegate = () =>
				{
					wasShareManagerInitialized = true;
				};

			viewModel.Parameter = Serializer.Serialize(
				new ViewPollPageNavigationCriteria { PollId = pollId });

			await viewModel.LoadPollAsync();

			((IActivate)viewModel).Activate();

			var dataPackage = new DataPackage();
			var dataPackageView = dataPackage.GetView();

			// Act
			ShareManager.ExecuteShareRequested(dataPackage);

			// Assert
			Assert.IsTrue(wasShareManagerInitialized, "Was Share Manager Initialized");
			Assert.IsTrue(!string.IsNullOrEmpty(await dataPackageView.GetTextAsync()), "Text Exists");
			Assert.AreEqual(string.Format("myvote://poll/{0}", pollId), (await dataPackageView.GetApplicationLinkAsync()).ToString(), "Uri");
			Assert.IsTrue(!string.IsNullOrEmpty(await dataPackageView.GetHtmlFormatAsync()), "HTML Exists");
		}
		public async Task LoadPollAsyncAlreadyVoted()
		{
			// Arrange
			var viewModel = GetViewModel();

			var random = new Random();

			var principal = new PrincipalMock();

			var identity = new UserIdentityMock();
			identity.UserID = random.Next();
			principal.Identity = identity;

			Csla.ApplicationContext.User = principal;

			var pollId = random.Next();

			viewModel.Parameter = Serializer.Serialize(
				new ViewPollPageNavigationCriteria { PollId = pollId });

			Type actualType = null;
			PollResultsPageNavigationCriteria actualParam = null;
			ObjectFactory.CreateAsyncDelegate = () => new PollSubmissionCommandMock();
			ObjectFactory.ExecuteAsyncDelegate = command => new PollSubmissionCommandMock();

			Navigation.NavigateToViewModelAndRemoveCurrentWithParameterDelegate = ((type, param) =>
			{
				actualType = type;
				actualParam = (PollResultsPageNavigationCriteria)param;
			});

			// Act
			await viewModel.LoadPollAsync();

			// Assert
			Assert.AreEqual(typeof(PollResultsPageViewModel), actualType, "Navigation Type");
			Assert.AreEqual(pollId, actualParam.PollId, "Navigated Poll Id");
		}