public void AddNewGenericProfile()
        {
            _uiServiceStub.Stub(_ => _.QueryProfileType()).Return(Contracts.ProfileType.Generic);

            _viewModel.SetOptionsCollection(new Contracts.Options[0]);
            _viewModel.AddCommand.Execute(null);

            var profile = (GenericOptionsViewModel)_viewModel.Options[0];

            profile.Name = "p1";
            profile.ServerSettingsViewModel.CalenderUrl = "http://caldav.com/";


            _optionTasksStub.Stub(_ => _.PickFolderOrNull()).Return(new OutlookFolder("folderId", "storeId", OlItemType.olAppointmentItem, "cal"));
            _optionTasksStub.Stub(_ => _.GetFolderAccountNameOrNull("storeId")).Return("accountName");
            profile.OutlookFolderViewModel.SelectFolderCommand.Execute(null);


            var closeRequestedHandlerMock = MockRepository.GenerateStrictMock <EventHandler <CloseEventArgs> >();

            closeRequestedHandlerMock.Expect(_ => _(Arg.Is(_viewModel), Arg <CloseEventArgs> .Matches(e => e.ShouldSaveNewOptions)));
            _viewModel.CloseRequested += closeRequestedHandlerMock;
            _viewModel.CloseCommand.Execute(true);
            closeRequestedHandlerMock.VerifyAllExpectations();

            var options = _viewModel.GetOptionsCollection().Single();

            Assert.That(options.Name, Is.EqualTo("p1"));
            Assert.That(options.CalenderUrl, Is.EqualTo("http://caldav.com/"));
            Assert.That(options.OutlookFolderEntryId, Is.EqualTo("folderId"));
            Assert.That(options.OutlookFolderStoreId, Is.EqualTo("storeId"));
            Assert.That(options.OutlookFolderAccountName, Is.EqualTo("accountName"));
            Assert.That(options.ServerAdapterType, Is.EqualTo(ServerAdapterType.WebDavHttpClientBased));
        }