예제 #1
0
 public void CanCopyItem()
 {
     StartPage startPage = new StartPage();
     Page page = new Page();
     bool canCopy = integrityManger.CanCopy(page, startPage);
     Assert.IsTrue(canCopy, "The page couldn't be copied to the destination.");
 }
예제 #2
0
 public void CanMoveItem()
 {
     StartPage startPage = new StartPage();
     Page page = new Page();
     bool canMove = integrityManger.CanMove(page, startPage);
     Assert.IsTrue(canMove, "The page couldn't be moved to the destination.");
 }
예제 #3
0
        public void CanCopyItemEvent()
        {
            StartPage startPage = new StartPage();
            Page page = new Page();

            copying.Raise(persister, new CancelDestinationEventArgs(page, startPage));
        }
예제 #4
0
 public override void Execute() {
   var view = MainFormManager.MainForm.Views.OfType<StartPage>().FirstOrDefault();
   if (view == null) {
     view = new StartPage();
     view.Show();
   } else if (view.IsShown) {
     view.Hide();
   } else {
     view.Show();
   }
 }
예제 #5
0
파일: Wiki.cs 프로젝트: hex6/Dota-2-ModKit
        public Wiki(Addon addon, string lang)
        {
            Addon = addon;
            Lang = lang;

            parseLanguageFile();
            // create a directory structure to store this wiki.
            createDirectories();

            StartPage = new StartPage(this);
            HeroesPage = new HeroesPage(this);
            UnitsPage = new UnitsPage(this);
            ItemsPage = new ItemsPage(this);
        }
예제 #6
0
        public static string RenderWebPage(WebPage page, StartPage startPage = null) {
            var writer = new StringWriter();

            // Create an actual dummy HttpContext that has a request object
            var filename = "default.aspx";
            var url = "http://localhost/default.aspx";
            var request = new HttpRequest(filename, url, null);
            var httpContext = new HttpContext(request, new HttpResponse(new StringWriter(new StringBuilder())));

            var pageContext = Util.CreatePageContext(httpContext);

            page.ExecutePageHierarchy(pageContext, writer, startPage);

            return writer.ToString();
        }
예제 #7
0
        public static string RenderWebPage(WebPage page, StartPage startPage = null, HttpRequestBase request = null)
        {
            var writer = new StringWriter();

            // Create an actual dummy HttpContext that has a request object
            var filename = "default.aspx";
            var url = "http://localhost/default.aspx";

            request = request ?? CreateTestRequest(filename, url).Object;
            var httpContext = CreateTestContext(request);

            var pageContext = new WebPageContext { HttpContext = httpContext.Object };
            page.ExecutePageHierarchy(pageContext, writer, startPage);
            return writer.ToString();
        }
예제 #8
0
 public TrackDetails()
 {
     selectedTrack = StartPage.SelectedTrack;
     InitializeComponent();
     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
         AppViewBackButtonVisibility.Visible;
     _startPage = Window.Current.Content as StartPage;
     if (_startPage == null) return;
     _streamPlayer = _startPage.MediaElement;
     if (selectedTrack == null || _streamPlayer == null) return;
     if (!selectedTrack.id.Equals(StartPage.CurrentTrack.id))
     {
         StartPage.CurrentTrack = selectedTrack.DeepcopyTrack();
         _streamPlayer.Source = new Uri(selectedTrack.stream_url);
         if (!_loaded)
         {
             CreateTimer();
             _loaded = true;
         }
         else
         {
             StartPage.AudioTimer?.Stop();
             CreateTimer();
         }
         _streamPlayer.Play();
         _startPage?.SetPlayButton(_play);
         TrackButtonPlayImage.Source = StartPage.ImageFromRelativePath(this, "Assets/pause27.png");
     }
     else
     {
         StartPage.AudioTimer?.Stop();
         CreateTimer();
     }
     _startPage.TrackInfo.Text = selectedTrack.title;
     BorderBrushDetails.ImageSource = new BitmapImage(new Uri(selectedTrack.background_url));
     TrackDetailsMain.DataContext = selectedTrack;
     ArtworkImage.Source = new BitmapImage(new Uri(selectedTrack.artwork_url));
     ArtistImage.Source = new BitmapImage(new Uri(selectedTrack.user.avatar_url));
     BitmapTransform(selectedTrack.waveform_url);
     _totalTime = selectedTrack.duration;
     AudioSlider.Maximum = _totalTime;
     AudioSlider.DataContext = _streamPlayer.Source;
     FollowArtist.Text = (selectedTrack.user.following ?  "follow" : "unfollow");
 }
예제 #9
0
        public App()
        {
            InitializeComponent();
            //new Test();
            PropertiesChecking();
            LookForMidnight();
            startPage = new StartPage();
            choosePage = new ChoosePage();
            MainPage = startPage;

            choosePage.LineClicked += (object sender, EventArgs args) =>
            {
                name = (string)sender;
                FromChooseToStartPage();
            };

            startPage.ChooseLabelClicked += OnChoosePage;
            startPage.StatisticLabelClicked += OnStatisticPage;
            startPage.StopLabelClicked += Stop;

            Device.StartTimer(TimeSpan.FromSeconds(0.5), Tick);
        }
예제 #10
0
        public void ClistElementsPos()
        {
            string a;

            Button bt1 = new Button("B1", true);
            Button bt2 = new Button("B2", true);
            Button bt3 = new Button("B3", true);

            List <Button> listButtonCorrect = new List <Button>();

            listButtonCorrect.Add(bt1);
            listButtonCorrect.Add(bt2);
            listButtonCorrect.Add(bt3);

            List <Button> listButtonForClick = new List <Button>();

            listButtonForClick.Add(bt1);
            listButtonForClick.Add(bt2);
            listButtonForClick.Add(bt3);

            StartPage st = new StartPage(listButtonCorrect, listButtonForClick);

            Assert.AreEqual(true, st.ClickAllButtons(out a));
        }
예제 #11
0
        protected override void OnInit(EventArgs e)
        {
            if (CurrentPage != null)
            {
                languages = Engine.Resolve <LanguageGatewaySelector>().GetLanguageGateway(CurrentPage);

                ContentItem language = languages.GetLanguage(CurrentPage) as ContentItem;

                StartPage start = Find.ClosestStartPage;

                if (p != null)
                {
                    p.Visible = (start != null) && start.ShowBreadcrumb;
                }
                if (dti != null)
                {
                    dti.Visible = CurrentPage["ShowTitle"] != null && (bool)CurrentPage["ShowTitle"];
                }
                if (t != null)
                {
                    t.Text = CurrentPage["HeadTitle"] as string ?? CurrentPage.Title;
                }
                if (dh != null)
                {
                    dh.CurrentItem = language;
                }

                if (zsl != null)
                {
                    zsl.CurrentItem = language;
                    dft.CurrentItem = language;
                }
            }

            base.OnInit(e);
        }
예제 #12
0
        public void SendFolderAfterSendingTest()
        {
            var startForm = new StartPage();

            startForm.Login(LogIn, Password);
            var inboxForm = new InboxPage();

            inboxForm.GoToSentPage();
            var sentForm = new SentPage();

            sentForm.DeleteAllSent();
            sentForm.GoToNewEmailPage();
            var emailForm = new EmailPage();

            emailForm.CreateADraft(EmailAddress, EmailSubject, EmailText);
            emailForm.GoToDraftPage();
            var draftForm = new DraftPage();

            draftForm.OpenEmail();
            emailForm.SendEmail();
            emailForm.GoToSentPage();

            Assert.IsTrue(sentForm.SentEmailExist());
        }
예제 #13
0
        /// <summary>加载时触发</summary>
        protected override void OnLoaded()
        {
#if __CORE__
            if (StartPage.IsNullOrEmpty())
            {
                StartPage =
                    // 避免出现生成 "/Admin/Admin/Index/Main" 这样的情况
                    //NewLife.Web.HttpContext.Current?.Request.PathBase.ToString().EnsureEnd("/") +
                    "/Admin/Index/Main";
            }
#else
            if (StartPage.IsNullOrEmpty())
            {
                StartPage = System.Web.HttpRuntime.AppDomainAppVirtualPath.EnsureEnd("/") + "Admin/Index/Main";
            }
#endif

            if (DefaultRole <= 0)
            {
                DefaultRole = 3;
            }

            base.OnLoaded();
        }
예제 #14
0
        public void CannotDeleteStartPageEvent()
        {
            StartPage startPage = new StartPage();

            mocks.Record();
            Expect.On(parser).Call(parser.IsRootOrStartPage(startPage)).Return(true);
            mocks.Replay(parser);

            ExceptionAssert.Throws<CannotDeleteRootException>(delegate
            {
                deleting.Raise(persister, new CancelItemEventArgs(startPage));
            });
            mocks.Verify(parser);
        }
예제 #15
0
        public void DisplayedLinkMailButton()
        {
            StartPage startPage = new StartPage(driver);

            Assert.IsTrue(startPage.LinkMailButton.Displayed);
        }
예제 #16
0
파일: WizardNew.cs 프로젝트: ewcasas/DVTK
        public WizardNew(StartPage page_nr)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.start_page = page_nr;

            switch (page_nr)
            {
                case StartPage.all:
                    this.current_page = 1;
                    ActiveControl = RadioNewProject;
                    break;

                case StartPage.project:
                    this.current_page = 2;
                    if (this.ProjectFileName.Text != "")
                    {
                        this.ButtonNext.Enabled = true;
                    }
                    else
                    {
                        this.ButtonNext.Enabled = false;
                    }
                    this.WizardPages.SelectedTab = this.Page2;
                    ActiveControl = ButtonBrowseProject;
                    break;

                case StartPage.session:
                    this.current_page = 4;
                    if (this.SessionFileName.Text != "")
                    {
                        this.ButtonNext.Enabled = true;
                    }
                    else
                    {
                        this.ButtonNext.Enabled = false;
                    }
                    this.WizardPages.SelectedTab = this.Page4;
                    ActiveControl = ButtonBrowseSession;
                    break;
            }
            // Initialize Page 2
            // Initialize Page 3
            this.created_project = false;
            // Initialize Page 4
            // Initialize Page 5
            this.TextBoxUserName.Text = SystemInformation.UserName;
            //this.DateSession.Value = DateTime.Today;
            // Initialize Page 6
            // Initialize Page 7
            // Initialize Page 8
            this.ListBoxSecuritySettings.SelectedIndex = 0;
            // Initialize Page 9
            // Initialize Page 10
            // Initialize Page 11
            // Initialize Page 12
            this.created_session = false;
        }
예제 #17
0
        /// <summary>
        /// Walks the page hierarcy to find the requested page.
        /// </summary>
        private static WebPageRenderingBase GetRootPage(StartPage page)
        {
            WebPageRenderingBase currentPage = null;
            while (page != null)
            {
                currentPage = page.ChildPage;
                page = currentPage as StartPage;
            }

            Debug.Assert(currentPage != null, "Should never be null");
            return currentPage;
        }
예제 #18
0
        public void DisplayedSelect()
        {
            StartPage startPage = new StartPage(driver);

            Assert.IsTrue(startPage.SelectDown.Displayed);
        }
예제 #19
0
        public void CanSave()
        {
            StartPage startPage = new StartPage();

            bool canSave = integrityManger.CanSave(startPage);
            Assert.IsTrue(canSave, "Couldn't save");
        }
 public static StartPageViewModel Create(StartPage currentPage) {
     var model = new StartPageViewModel(currentPage);
     PageViewModelBuilder.SetBaseProperties(model);
     model.LatestNews = GetLatestNews();
     return model;
 }
예제 #21
0
        public static void Main(string[] args = null)
        {
            if (String.IsNullOrEmpty(Settings.Default.InstallationId)) // Each instance to have GUID
            {
                Settings.Default.InstallationId = Guid.NewGuid().ToString();
            }

            // don't allow 64-bit Skyline to run in a 32-bit process
            if (Install.Is64Bit && !Environment.Is64BitProcess)
            {
                string installUrl   = Install.Url;
                string installLabel = (installUrl == string.Empty) ? string.Empty : string.Format(Resources.Program_Main_Install_32_bit__0__, Name);
                AlertLinkDlg.Show(null,
                                  string.Format(Resources.Program_Main_You_are_attempting_to_run_a_64_bit_version_of__0__on_a_32_bit_OS_Please_install_the_32_bit_version, Name),
                                  installLabel,
                                  installUrl);
                return;
            }

            CommonFormEx.TestMode      = FunctionalTest;
            CommonFormEx.Offscreen     = SkylineOffscreen;
            CommonFormEx.ShowFormNames = FormEx.ShowFormNames = ShowFormNames;

            // For testing and debugging Skyline command-line interface
            if (args != null && args.Length > 0)
            {
                if (!CommandLineRunner.HasCommandPrefix(args[0]))
                {
                    TextWriter textWriter;
                    if (Debugger.IsAttached)
                    {
                        textWriter = new DebugWriter();
                    }
                    else
                    {
                        AttachConsole(-1);
                        textWriter = Console.Out;
                        Console.WriteLine();
                        Console.WriteLine();
                    }
                    var writer = new CommandStatusWriter(textWriter);
                    if (args[0].Equals("--ui", StringComparison.InvariantCultureIgnoreCase)) // Not L10N
                    {
                        // ReSharper disable once ObjectCreationAsStatement
                        new CommandLineUI(args, writer);
                    }
                    else
                    {
                        CommandLineRunner.RunCommand(args, writer);
                    }
                }
                else
                {
                    // For testing SkylineRunner without installation
                    CommandLineRunner clr = new CommandLineRunner();
                    clr.Start(args[0]);
                }

                return;
            }
            // The way Skyline command-line interface is run for an installation
            else if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null &&
                     AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData != null &&
                     AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData.Length > 0 &&
                     CommandLineRunner.HasCommandPrefix(AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0])) // Not L10N
            {
                CommandLineRunner clr = new CommandLineRunner();
                clr.Start(AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0]);

                // HACK: until the "invalid string binding" error is resolved, this will prevent an error dialog at exit
                Process.GetCurrentProcess().Kill();
                return;
            }

            try
            {
                Init();
                if (!string.IsNullOrEmpty(Settings.Default.DisplayLanguage))
                {
                    try
                    {
                        LocalizationHelper.CurrentUICulture =
                            CultureInfo.GetCultureInfo(Settings.Default.DisplayLanguage);
                    }
                    catch (CultureNotFoundException)
                    {
                    }
                }
                LocalizationHelper.InitThread(Thread.CurrentThread);

                // Make sure the user has agreed to the current license version
                // or one more recent.
                int licenseVersion = Settings.Default.LicenseVersionAccepted;
                if (licenseVersion < LICENSE_VERSION_CURRENT && !NoSaveSettings)
                {
                    // If the user has never used the application before, then
                    // they must have agreed to the current license agreement during
                    // installation.  Otherwise, make sure they agree to the new
                    // license agreement.
                    if (Install.Type == Install.InstallType.release &&
                        (licenseVersion != 0 || !Settings.Default.MainWindowSize.IsEmpty))
                    {
                        using (var dlg = new UpgradeDlg(licenseVersion))
                        {
                            if (dlg.ShowDialog() == DialogResult.Cancel)
                            {
                                return;
                            }
                        }
                    }

                    try
                    {
                        // Make sure the user never sees this again for this license version
                        Settings.Default.LicenseVersionAccepted = LICENSE_VERSION_CURRENT;
                        Settings.Default.Save();
                    }
// ReSharper disable EmptyGeneralCatchClause
                    catch (Exception)
// ReSharper restore EmptyGeneralCatchClause
                    {
                        // Just try to update the license version next time.
                    }
                }

                try
                {
                    // If this is a new installation copy over installed external tools from previous installation location.
                    var toolsDirectory = ToolDescriptionHelpers.GetToolsDirectory();
                    if (!Directory.Exists(toolsDirectory))
                    {
                        using (var longWaitDlg = new LongWaitDlg
                        {
                            Text = Name,
                            Message = Resources.Program_Main_Copying_external_tools_from_a_previous_installation,
                            ProgressValue = 0
                        })
                        {
                            longWaitDlg.PerformWork(null, 1000 * 3, broker => CopyOldTools(toolsDirectory, broker));
                        }
                    }
                }
                // ReSharper disable once EmptyGeneralCatchClause
                catch
                {
                }

                // Force live reports (though tests may reset this)
                //Settings.Default.EnableLiveReports = true;

                if (ReportShutdownDlg.HadUnexpectedShutdown())
                {
                    using (var reportShutdownDlg = new ReportShutdownDlg())
                    {
                        reportShutdownDlg.ShowDialog();
                    }
                }
                SystemEvents.DisplaySettingsChanged += SystemEventsOnDisplaySettingsChanged;
                // Careful, a throw out of the SkylineWindow constructor without this
                // catch causes Skyline just to appear to silently never start.  Makes for
                // some difficult debugging.
                try
                {
                    var activationArgs = AppDomain.CurrentDomain.SetupInformation.ActivationArguments;
                    if ((activationArgs != null &&
                         activationArgs.ActivationData != null &&
                         activationArgs.ActivationData.Length != 0) ||
                        !Settings.Default.ShowStartupForm)
                    {
                        MainWindow = new SkylineWindow(args);
                    }
                    else
                    {
                        StartWindow = new StartPage();
                        try
                        {
                            if (StartWindow.ShowDialog() != DialogResult.OK)
                            {
                                Application.Exit();
                                return;
                            }

                            MainWindow = StartWindow.MainWindow;
                        }
                        finally
                        {
                            StartWindow.Dispose();
                            StartWindow = null;
                        }
                    }
                }
                catch (Exception x)
                {
                    ReportExceptionUI(x, new StackTrace(1, true));
                }

                ConcurrencyVisualizer.StartEvents(MainWindow);

                // Position window offscreen for stress testing.
                if (SkylineOffscreen)
                {
                    FormEx.SetOffscreen(MainWindow);
                }

                ActionUtil.RunAsync(() =>
                {
                    try {
                        SendAnalyticsHit();
                    } catch (Exception ex) {
                        Trace.TraceWarning("Exception sending analytics hit {0}", ex);  // Not L10N
                    }
                });
                MainToolServiceName = Guid.NewGuid().ToString();
                Application.Run(MainWindow);
                StopToolService();
            }
            catch (Exception x)
            {
                // Send unhandled exceptions to the console.
                Console.WriteLine(x.Message);
                Console.Write(x.StackTrace);
            }

            MainWindow = null;
        }
예제 #22
0
 /// <summary>
 /// Ensure that the current request is authorized. 
 /// If the request is authenticated, then we skip all other checks.
 /// </summary>
 internal static void Authorize(StartPage page)
 {
     Authorize(page, HostingEnvironment.VirtualPathProvider, VirtualPathUtility.ToAppRelative);
 }
예제 #23
0
 public void GetStartPage_ThrowsOnNullPage()
 {
     Assert.ThrowsArgumentNull(() => StartPage.GetStartPage(null, "name", new[] { "cshtml" }), "page");
 }
예제 #24
0
        public void GetStartPage_ThrowsOnNullSupportedExtensions()
        {
            var page = Utils.CreatePage(p => p.Write("test"));

            Assert.ThrowsArgumentNull(() => StartPage.GetStartPage(page, "name", null), "supportedExtensions");
        }
예제 #25
0
 internal static void Authorize(StartPage page, VirtualPathProvider vpp, Func<string, string> makeAppRelative)
 {
     if (!IsAuthenticated(page.Request))
     {
         if (HasAdminPassword(vpp))
         {
             // If there is a password file (Password.config) then we redirect to the login page
             RedirectSafe(page, SiteAdmin.LoginVirtualPath, makeAppRelative);
         }
         else if (HasTemporaryPassword(vpp))
         {
             // Dev 10 941521: Admin: Pass through returnurl into page that tells the user to rename _password.config
             // If there is a disabled password file (_Password.config) then we redirect to the instructions page
             RedirectSafe(page, SiteAdmin.EnableInstructionsVirtualPath, makeAppRelative);
         }
         else
         {
             // The user hasn't done anything so redirect to the register page.
             RedirectSafe(page, SiteAdmin.RegisterVirtualPath, makeAppRelative);
         }
     }
 }
예제 #26
0
        /// <summary>Finds the path associated with an url.</summary>
        /// <param name="url">The url to the template to locate.</param>
        /// <param name="startNode">The node to start finding path from if none supplied will start from StartNode</param>
        /// <param name="remainingPath">The remaining path to search</param>
        /// <returns>A PathData object. If no template was found the object will have empty properties.</returns>
        public PathData FindPath(Url url, ContentItem startNode = null, string remainingPath = null)
        {
            if (url == null)
            {
                return(PathData.Empty);
            }
            if (!IsOnline)
            {
                return(PathData.Empty);
            }

            Url         requestedUrl = url;
            ContentItem item         = TryLoadingFromQueryString(requestedUrl, PathData.ItemQueryKey);
            ContentItem page         = TryLoadingFromQueryString(requestedUrl, PathData.PageQueryKey);

            if (page != null)
            {
                var directPath = page.FindPath(requestedUrl["action"] ?? PathData.DefaultAction)
                                 .SetArguments(requestedUrl["arguments"])
                                 .UpdateParameters(requestedUrl.GetQueries());

                var directData = UseItemIfAvailable(item, directPath);
                // check whether to rewrite requests with page in query string since this might be already rewritten
                directData.IsRewritable &= !string.Equals(url.ApplicationRelativePath, directData.TemplateUrl, StringComparison.InvariantCultureIgnoreCase);
                return(directData);
            }

            ContentItem startPage = startNode ?? GetStartPage(requestedUrl);

            if (startPage == null)
            {
                return(PathData.Empty);
            }

            string   path = remainingPath ?? Url.ToRelative(requestedUrl.Path).TrimStart('~');
            PathData data = startPage.FindPath(path).UpdateParameters(requestedUrl.GetQueries());

            if (data.IsEmpty())
            {
                if (!string.IsNullOrEmpty(DefaultDocument) && path.EndsWith(DefaultDocument, StringComparison.OrdinalIgnoreCase))
                {
                    // Try to find path without default document.
                    data = StartPage
                           .FindPath(StripDefaultDocument(path))
                           .UpdateParameters(requestedUrl.GetQueries());
                }

                if (data.IsEmpty())
                {
                    // Allow user code to set path through event
                    if (PageNotFound != null)
                    {
                        PageNotFoundEventArgs args = new PageNotFoundEventArgs(requestedUrl);
                        args.AffectedPath = data;
                        PageNotFound(this, args);
                        data = args.AffectedPath;
                    }
                }
            }

            data.Ignore = !IgnoreExisting(webContext.HttpContext.Request.PhysicalPath);
            data        = UseItemIfAvailable(item, data);
            return(data);
        }
예제 #27
0
        /// <summary>
        /// Doesn't do a redirect if the requesting page is itself the same as the virtual path.
        /// We need to do this since it is called from the _pagestart.cshtml which always runs.
        /// </summary>
        private static void RedirectSafe(StartPage page, string virtualPath, Func<string, string> makeAppRelative)
        {
            // Make sure we get the virtual path
            virtualPath = SiteAdmin.GetVirtualPath(virtualPath);

            if (!IsRequestingPage(page, virtualPath))
            {
                // Append the redirect url querystring
                virtualPath = SiteAdmin.GetRedirectUrl(page.Request, virtualPath, makeAppRelative);

                page.Context.Response.Redirect(virtualPath);
            }
        }
예제 #28
0
        public void CannotMoveIfTypeIsntAllowed()
        {
            StartPage startPage = new StartPage();
            Page page = new Page();

            bool canMove = integrityManger.CanMove(startPage, page);
            Assert.IsFalse(canMove, "The start page could be moved even though a page isn't an allowed destination.");
        }
예제 #29
0
 public void WhenIOpenGoogleStartPage()
 {
     driver.Navigate().GoToUrl(START_PAGE_URL);
     startPage = StartPage.Create(driver);
 }
예제 #30
0
        public void CannotMoveIfTypeIsntAllowedEvent()
        {
            StartPage startPage = new StartPage();
            Page page = new Page();

            ExceptionAssert.Throws<NotAllowedParentException>(delegate
            {
                moving.Raise(persister, new CancelDestinationEventArgs(startPage, page));
            });
        }
예제 #31
0
        public void CanMoveItemEvent()
        {
            StartPage startPage = new StartPage();
            Page page = new Page();

            moving.Raise(persister, new CancellableDestinationEventArgs(page, startPage));
        }
예제 #32
0
        public void CanSaveEvent()
        {
            StartPage startPage = new StartPage();

            saving.Raise(persister, new CancelItemEventArgs(startPage));
        }
예제 #33
0
        public void NewsLink()
        {
            StartPage startPage = new StartPage(driver);

            Assert.IsTrue(startPage.NewsLink.Displayed);
        }
예제 #34
0
 public StartPageAdditionalProperties GetStartPageAdditionalProperties(StartPage startpage)
 {
     return(new StartPageAdditionalProperties());
 }
예제 #35
0
 private void GoBack_Click(object sender, RoutedEventArgs e)
 {
     StartPage StartPage = new StartPage();
     StartPage.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     StartPage.Show();
     this.Close();
 }
예제 #36
0
        private void InitializeLoginViewModel(InternalLoginViewModel viewModel)
        {
            StartPage startPage = _contentLoader.Get <StartPage>(ContentReference.StartPage);

            viewModel.ResetPasswordPage = startPage.ResetPasswordPage;
        }
예제 #37
0
        public async Task <IActionResult> Seed()
        {
            // Get the default site
            var site = await _api.Sites.GetDefaultAsync();

            // Add media assets
            var bannerId = Guid.NewGuid();

            using (var stream = System.IO.File.OpenRead("seed/pexels-photo-355423.jpeg"))
            {
                await _api.Media.SaveAsync(new Piranha.Models.StreamMediaContent()
                {
                    Id       = bannerId,
                    Filename = "pexels-photo-355423.jpeg",
                    Data     = stream
                });
            }

            // Add the blog archived
            var blogId   = Guid.NewGuid();
            var blogPage = await BlogArchive.CreateAsync(_api);

            blogPage.Id                = blogId;
            blogPage.SiteId            = site.Id;
            blogPage.Title             = "Blog Archive";
            blogPage.MetaKeywords      = "Inceptos, Tristique, Pellentesque, Lorem, Vestibulum";
            blogPage.MetaDescription   = "Morbi leo risus, porta ac consectetur ac, vestibulum at eros.";
            blogPage.NavigationTitle   = "Blog";
            blogPage.Hero.PrimaryImage = bannerId;
            blogPage.Hero.Ingress      = "Curabitur blandit tempus porttitor. Maecenas sed diam eget risus varius blandit sit amet non magna.";
            blogPage.Published         = DateTime.Now;

            await _api.Pages.SaveAsync(blogPage);

            // Add a blog post
            var postId = Guid.NewGuid();
            var post   = await BlogPost.CreateAsync(_api);

            post.Id       = postId;
            post.BlogId   = blogPage.Id;
            post.Category = "Uncategorized";
            post.Tags.Add("Ornare", "Pellentesque", "Fringilla Ridiculus");
            post.Title             = "Dapibus Cursus Justo";
            post.MetaKeywords      = "Nullam, Mollis, Cras, Sem, Ipsum";
            post.MetaDescription   = "Aenean lacinia bibendum nulla sed consectetur.";
            post.Hero.PrimaryImage = bannerId;
            post.Hero.Ingress      = "Sed posuere consectetur est at lobortis. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.";
            post.Blocks.Add(new HtmlBlock
            {
                Body = "<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas sed diam eget risus varius blandit sit amet non magna. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Curabitur blandit tempus porttitor. Maecenas faucibus mollis interdum.</p>"
            });
            post.Published = DateTime.Now;

            await _api.Posts.SaveAsync(post);

            // Add the startpage
            var startPage = await StartPage.CreateAsync(_api);

            startPage.SiteId            = site.Id;
            startPage.Title             = "Porta Tortor Euismod";
            startPage.MetaKeywords      = "Fusce, Tristique, Nullam, Parturient, Pellentesque";
            startPage.MetaDescription   = "Vestibulum id ligula porta felis euismod semper.";
            startPage.NavigationTitle   = "Home";
            startPage.Hero.PrimaryImage = bannerId;
            startPage.Hero.Ingress      = "Aenean lacinia bibendum nulla sed consectetur.";
            startPage.Blocks.Add(new HtmlBlock
            {
                Body = "<p>Nulla vitae elit libero, a pharetra augue. Curabitur blandit tempus porttitor. Nulla vitae elit libero, a pharetra augue. Donec id elit non mi porta gravida at eget metus. Curabitur blandit tempus porttitor.</p><p>Etiam porta sem malesuada magna mollis euismod. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Curabitur blandit tempus porttitor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>"
            });
            startPage.Published = DateTime.Now;

            // Add teasers
            startPage.Teasers.Add(new Teaser()
            {
                Title    = "Lorem Consectetur",
                SubTitle = "Ultricies Nullam Cras",
                Body     = "Aenean lacinia bibendum nulla sed consectetur. Donec id elit non mi porta gravida at eget metus.",
                PageLink = blogPage
            });
            startPage.Teasers.Add(new Teaser()
            {
                Title    = "Vestibulum Bibendum",
                SubTitle = "Tortor Cras Tristique",
                Body     = "Nullam id dolor id nibh ultricies vehicula ut id elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam.",
                PostLink = post
            });

            await _api.Pages.SaveAsync(startPage);

            return(Redirect("~/"));
        }
예제 #38
0
        public void GetStartPage_ThrowsOnEmptyFileName()
        {
            var page = Utils.CreatePage(p => p.Write("test"));

            Assert.ThrowsArgumentNullOrEmptyString(() => StartPage.GetStartPage(page, String.Empty, new[] { "cshtml" }), "fileName");
        }
예제 #39
0
 public StartPage ClickLoginBtn()
 {
     loginBtn.Click();
     return(StartPage.GetStartPage());
 }
예제 #40
0
 public StartPageController(StartPage page)
 {
     this.page = page;
 }
예제 #41
0
        public async Task <IActionResult> Seed()
        {
            // Get the default site
            var site = await _api.Sites.GetDefaultAsync();

            // Add media assets
            var bannerId = Guid.NewGuid();

            using (var stream = System.IO.File.OpenRead("seed/pexels-photo-355423.jpeg"))
            {
                await _api.Media.SaveAsync(new Piranha.Models.StreamMediaContent()
                {
                    Id       = bannerId,
                    Filename = "pexels-photo-355423.jpeg",
                    Data     = stream
                });
            }

            // Add the blog archived
            var blogId   = Guid.NewGuid();
            var blogPage = BlogArchive.Create(_api);

            blogPage.Id                = blogId;
            blogPage.SiteId            = site.Id;
            blogPage.Title             = "Blog Archive";
            blogPage.MetaKeywords      = " software, website ,appdev,appbuider,backend";
            blogPage.MetaDescription   = "software through to the finalt includes all that is involved between.";
            blogPage.NavigationTitle   = "Blog";
            blogPage.Hero.PrimaryImage = bannerId;
            blogPage.Hero.Ingress      = "software through to the finalt includes all that is involved between.";
            blogPage.Published         = DateTime.Now;

            await _api.Pages.SaveAsync(blogPage);

            // Add a blog post
            var postId = Guid.NewGuid();
            var post   = BlogPost.Create(_api);

            post.Id       = postId;
            post.BlogId   = blogPage.Id;
            post.Category = "Software";
            post.Tags.Add("Software develepement", "Machine Learning", "Technologies");
            post.Title             = "Software developement";
            post.MetaKeywords      = " software, website ,appdev,appbuider,backend";
            post.MetaDescription   = "software through to the finalt includes all that is involved between.";
            post.Hero.PrimaryImage = bannerId;
            post.Hero.Ingress      = " Software through to the final manifestation of the software it includes all that is involved between.";
            post.Blocks.Add(new HtmlBlock
            {
                Body = "<p>it includes all that is involved between the conception of the desired software through to the final manifestation of the software it includes all that is involved between the conception of the desired software through to the final manifestation of the software.</p>"
            });
            post.Published = DateTime.Now;

            await _api.Posts.SaveAsync(post);

            // Add the startpage
            var startPage = StartPage.Create(_api);

            startPage.SiteId            = site.Id;
            startPage.Title             = "Machine Learning";
            startPage.MetaKeywords      = "Software,webdev,machine learning, technologies, web";
            startPage.MetaDescription   = "software through to the finalt includes all that is involved between.";
            startPage.NavigationTitle   = "Home";
            startPage.Hero.PrimaryImage = bannerId;
            startPage.Hero.Ingress      = "software through to the finalt includes all that is involved between.";
            startPage.Blocks.Add(new HtmlBlock
            {
                Body = "<p>Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software components..</p>"
            });
            startPage.Published = DateTime.Now;

            // Add teasers
            startPage.Teasers.Add(new Teaser()
            {
                Title    = "Software Prod",
                SubTitle = "Software staging",
                Body     = "Software development is a process of writing and maintaining the source code, but in a broader sense,.",
                PageLink = blogPage
            });
            startPage.Teasers.Add(new Teaser()
            {
                Title    = "Sftware in Practice",
                SubTitle = "Software Dev",
                Body     = "Tt includes all that is involved between the conception of the desired software through to the final manifestation of the software.",
                PostLink = post
            });

            await _api.Pages.SaveAsync(startPage);

            return(Redirect("~/"));
        }
예제 #42
0
        private void Next_Page(object sender, RoutedEventArgs e)
        {
            StartPage start = new StartPage();

            Frame.Navigate(start);
        }
예제 #43
0
 public App()
 {
     // The root page of your application
     MainPage = new StartPage();
 }
예제 #44
0
 public void BasicSearch()
 {
     StartPage.MakeSearch("8-bit knit nerd");
     Assert.IsTrue(SearchResultsPage.PageIsLoaded());
 }
예제 #45
0
파일: User.cs 프로젝트: jbfp/Todoist.NET
        /// <summary>
        /// Update user
        /// </summary>
        /// <param name="newEmail">
        /// New email
        /// </param>
        /// <param name="newFullName">
        /// New name
        /// </param>
        /// <param name="newPassword">
        /// New password
        /// </param>
        /// <param name="newTimeZone">
        /// New timezone
        /// </param>
        /// <param name="newDateFormat">
        /// New dateformat
        /// </param>
        /// <param name="newTimeFormat">
        /// New timeformat
        /// </param>
        /// <param name="newStartPage">
        /// New startpage
        /// </param>
        public void UpdateUser(
            string newEmail, 
            string newFullName, 
            string newPassword, 
            string newTimeZone, 
            DateFormat? newDateFormat, 
            TimeFormat? newTimeFormat, 
            StartPage? newStartPage)
        {
            this.CheckLoginStatus();

            Uri uri = Core.ConstructUri(
                "updateUser?", 
                string.Format(
                    "token={0}&" + "email={1}&" + "full_name={2}&" + "password={3}&" + "timezone={4}&"
                    + "date_format={5}&" + "time_format={6}&" + "start_page={7}", 
                    this.ApiToken, 
                    newEmail, 
                    newFullName, 
                    newPassword, 
                    newTimeZone, 
                    newDateFormat, 
                    newTimeFormat, 
                    newStartPage), 
                true);

            string jsonResponse = Core.GetJsonData(uri);

            switch (jsonResponse)
            {
                case "\"ERROR_PASSWORD_TOO_SHORT\"":
                    throw new UpdateUserException(
                        "The password provided is too short. It must be at least 5 characters long.");
                case "\"ERROR_EMAIL_FOUND\"":
                    throw new UpdateUserException(
                        "The e-mail address provided has already been registered with Todoist with another account.");
            }

            this.jsonData = jsonResponse;
            this.AnalyseJson();
        }
        public App()
        {
            InitializeComponent();

            MainPage = new StartPage();
        }
예제 #47
0
        private void BackToStart()
        {
            var page1 = new StartPage();

            ((MainWindow)Application.Current.MainWindow).Main.Content = page1;
        }
예제 #48
0
        public void RegistrationHeaderLink()
        {
            StartPage startPage = new StartPage(driver);

            Assert.IsTrue(startPage.RegistrationHeaderLink.Displayed);
        }
예제 #49
0
 private void GoHome(object sender, RoutedEventArgs e)
 {
     Places.IsOpen = false;
     var page = new StartPage();
     page.FillDrives();
     var tab = (TabItem) tabDynamic.SelectedItem;
     tab.Header = "This PC";
     tab.Content = page;
     
     
 }
예제 #50
0
        public void DisplayedPassword()
        {
            StartPage startPage = new StartPage(driver);

            Assert.IsTrue(startPage.PassInput.Displayed);
        }
        public CheckoutViewModelFactoryTests()
        {
            _cart = new FakeCart(new MarketImpl(new MarketId(Currency.USD)), Currency.USD);
            _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem());
            _cart.Forms.Single().CouponCodes.Add("couponcode");

            var paymentServiceMock = new Mock <IPaymentService>();

            paymentServiceMock.Setup(x => x.GetPaymentMethodsByMarketIdAndLanguageCode(It.IsAny <string>(), "en")).Returns(
                new[]
            {
                new PaymentMethodViewModel()
                {
                    PaymentMethodId = Guid.NewGuid(), Description = "Lorem ipsum", FriendlyName = "payment method 1", SystemKeyword = cashPaymentName
                },
                new PaymentMethodViewModel()
                {
                    PaymentMethodId = Guid.NewGuid(), Description = "Lorem ipsum", FriendlyName = "payment method 2", SystemKeyword = creditPaymentName, IsDefault = true
                }
            });

            var marketMock          = new Mock <IMarket>();
            var currentMarketMock   = new Mock <ICurrentMarket>();
            var languageServiceMock = new Mock <LanguageService>(null, null, null);

            currentMarketMock.Setup(x => x.GetCurrentMarket()).Returns(marketMock.Object);
            languageServiceMock.Setup(x => x.GetCurrentLanguage()).Returns(new CultureInfo("en-US"));

            var cashOnDeliveryPaymentOption = new CashOnDeliveryPaymentOption(null, null, currentMarketMock.Object, languageServiceMock.Object, paymentServiceMock.Object);
            var creaditPaymentOption        = new GenericCreditCardPaymentOption(null, null, currentMarketMock.Object, languageServiceMock.Object, paymentServiceMock.Object);

            var paymentOptions = new List <IPaymentOption>();

            paymentOptions.Add(cashOnDeliveryPaymentOption as IPaymentOption);
            paymentOptions.Add(creaditPaymentOption as IPaymentOption);
            _creditPayment = creaditPaymentOption;

            var paymentMethodViewModelFactory = new PaymentMethodViewModelFactory(currentMarketMock.Object, languageServiceMock.Object, paymentServiceMock.Object, paymentOptions);

            var orderGroupFactoryMock = new Mock <IOrderGroupFactory>();

            orderGroupFactoryMock.Setup(x => x.CreatePayment(It.IsAny <IOrderGroup>())).Returns((IOrderGroup orderGroup) => new FakePayment());
            var serviceLocatorMock = new Mock <IServiceLocator>();

            serviceLocatorMock.Setup(x => x.GetInstance <IOrderGroupFactory>()).Returns(orderGroupFactoryMock.Object);
            ServiceLocator.SetLocator(serviceLocatorMock.Object);

            _addressBookServiceMock = new Mock <IAddressBookService>();
            _addressBookServiceMock.Setup(x => x.List()).Returns(() => new List <AddressModel> {
                new AddressModel {
                    AddressId = "addressid"
                }
            });
            _preferredBillingAddress      = CustomerAddress.CreateInstance();
            _preferredBillingAddress.Name = "preferredBillingAddress";
            _addressBookServiceMock.Setup(x => x.GetPreferredBillingAddress()).Returns(_preferredBillingAddress);
            _addressBookServiceMock.Setup(x => x.UseBillingAddressForShipment()).Returns(true);

            _startPage = new StartPage();
            var contentLoaderMock = new Mock <IContentLoader>();

            contentLoaderMock.Setup(x => x.Get <StartPage>(It.IsAny <PageReference>())).Returns(_startPage);

            var urlResolverMock = new Mock <UrlResolver>();
            var httpcontextMock = new Mock <HttpContextBase>();
            var requestMock     = new Mock <HttpRequestBase>();

            requestMock.Setup(x => x.Url).Returns(new Uri("http://site.com"));
            requestMock.Setup(x => x.UrlReferrer).Returns(new Uri("http://site.com"));
            httpcontextMock.Setup(x => x.Request).Returns(requestMock.Object);

            var shipmentViewModelFactoryMock = new Mock <ShipmentViewModelFactory>(null, null, null, null, null);

            shipmentViewModelFactoryMock.Setup(x => x.CreateShipmentsViewModel(It.IsAny <ICart>())).Returns(() => new[]
            {
                new ShipmentViewModel {
                    CartItems = new[]
                    {
                        new CartItemViewModel {
                            Quantity = 1
                        }
                    }
                }
            });

            _subject = new CheckoutViewModelFactory(
                new MemoryLocalizationService(),
                (() => paymentMethodViewModelFactory),
                _addressBookServiceMock.Object,
                contentLoaderMock.Object,
                urlResolverMock.Object,
                (() => httpcontextMock.Object),
                shipmentViewModelFactoryMock.Object);
        }
예제 #52
0
        public void DisplayedSendButton()
        {
            StartPage startPage = new StartPage(driver);

            Assert.IsTrue(startPage.SendButton.Displayed);
        }
예제 #53
0
        // This method is about what we ended up with in "Fund." - with a few changes done for Adv.
        public ActionResult CheckOut(CheckOutViewModel model)
        {
            // SplitPay is in a Session-variable (bool)
            string paymentProcessResult = String.Empty;

            // Load the cart, it should be one there
            var cart = _orderRepository.Load <ICart>(GetContactId(), "Default").FirstOrDefault();

            if (cart == null)
            {
                throw new InvalidOperationException("No cart found"); // make nicer
            }

            #region What actually happens when loading a cart - Adv.

            //Cart cart = OrderContext.Current.GetCart(
            //    "SomeCart"
            //    , CustomerContext.Current.CurrentContactId
            //    , MarketId.Default); // ...is still what happens in behind

            #endregion

            // should clean-up among payments here if the  first time failed - Qty 10 test
            // quick fixdon in the base class

            // From Fund
            IOrderAddress theAddress = AddAddressToOrder(cart);

            // ToDo: Added this field for Adv. & Find ... doing it simple now using one Address
            // The address is for Find, but we need to add it to MDP to be able to use it properly
            // This is a Serialized cart, so doesn't crash if the field is not added to MDP
            theAddress.Properties["AddressType"] = "Shipping";

            #region Ship & Pay from Fund

            // ToDo: Define Shipping - From Fund
            AdjustFirstShipmentInOrder(cart, theAddress, model.SelectedShipId); // ...as a Shipment is added by epi

            // ToDo: Define Payment - From Fund
            AddPaymentToOrder(cart, model.SelectedPayId); // ...as this is not added by default

            #endregion

            #region Split Pay

            // RoCe: Fix this - addSecondPayment comes in as a param (bool)
            // ... force for now if BF-Card is found ... using Session
            if ((bool)Session["SecondPayment"] == true)
            {
                ccService.AddSecondPaymentToOrder(cart);
            }

            // gathered info
            this.frontEndMessage = ccService.FrontEndMessage;

            #endregion

            // Possible change of the cart... adding this
            // would have this done if a flag were set
            var cartReference = _orderRepository.Save(cart);

            // Original Fund... (with additions)
            IPurchaseOrder purchaseOrder;
            OrderReference orderReference;

            #region Transaction Scope

            using (var scope = new Mediachase.Data.Provider.TransactionScope()) // one in BF, also
            {
                var validationIssues = new Dictionary <ILineItem, ValidationIssue>();

                // Added - sets a lock on inventory...
                // ...could come earlier (outside tran) depending on TypeOf-"store"
                _inventoryProcessor.AdjustInventoryOrRemoveLineItem(cart.GetFirstShipment()
                                                                    , OrderStatus.InProgress, (item, issue) => validationIssues.Add(item, issue));

                if (validationIssues.Count >= 1)
                {
                    throw new Exception("Not possible right now"); // ...change approach
                }

                // just checking the cart in watch window
                var theShipping  = cart.GetFirstShipment();
                var theLineItems = cart.GetAllLineItems();
                var firstPayment = cart.GetFirstForm().Payments.First(); // no "GetFirstPayment()"
                var theforms     = cart.Forms;

                //_lineItemCalculator.GetDiscountedPrice()
                // second payment is added in the Trousers-Controller
                // ...fiddling with the GiftCarde as well

                // before 11
                //cart.ProcessPayments(_paymentProcessor, _orderGroupCalculator);

                // Gets the older one
                //IEnumerable<PaymentProcessingResult> theResult
                //    = cart.ProcessPayments(_paymentProcessor, _orderGroupCalculator);
                //paymentProcessResult = theResult.First().Message;

                PaymentProcessingResult otherResult =
                    _paymentProcessor.ProcessPayment(cart, cart.GetFirstForm().Payments.First(), cart.GetFirstShipment());

                frontEndMessage += otherResult.Message;

                if (otherResult.IsSuccessful)
                {
                    IPayment thePay = cart.GetFirstForm().Payments.First();
                    thePay.Status = PaymentStatus.Processed.ToString();
                }
                else
                {
                    IPayment thePay = cart.GetFirstForm().Payments.First();
                    thePay.Status = PaymentStatus.Failed.ToString();
                    throw new System.Exception("Bad payment"); // could have more grace
                }
                // A custom "shipping-processor" created (needs to do OldSchool-things right now)
                // Have a custom (very simple) Shipping-Provider added to the solution.
                // the processor can be cleaned up a lot, no need to show it

                // Custom thing... Error in 11... on currency... check later
                //ShippingProcessor p = new ShippingProcessor();
                //p.ProcessShipments(cart as OrderGroup); // have to go Old-school

                // ...only one form, still
                var totalProcessedAmount = cart.GetFirstForm().Payments.Where
                                               (x => x.Status.Equals(PaymentStatus.Processed.ToString())).Sum(x => x.Amount);

                // nice extension method
                var cartTotal = cart.GetTotal();

                // Do inventory - decrement or put back in stock
                if (totalProcessedAmount != cart.GetTotal(_orderGroupCalculator).Amount)
                {
                    // put back the reserved request
                    _inventoryProcessor.AdjustInventoryOrRemoveLineItem(cart.GetFirstShipment()
                                                                        , OrderStatus.Cancelled, (item, issue) => validationIssues.Add(item, issue));

                    #region OldSchool Inventory - no demo,just checking ... were undocumented and wrong in SDK
                    //List<InventoryRequestItem> requestItems = new List<InventoryRequestItem>(); // holds the "items"
                    //InventoryRequestItem requestItem = new InventoryRequestItem();

                    //// calls for some logic
                    //requestItem.RequestType = InventoryRequestType.Cancel; // as a demo
                    //requestItem.OperationKey = reqKey;

                    //requestItems.Add(requestItem);

                    //InventoryRequest inventoryRequest = new InventoryRequest(DateTime.UtcNow, requestItems, null);
                    //InventoryResponse inventoryResponse = _invService.Service.Request(inventoryRequest);

                    //InventoryRecord rec4 = _invService.Service.Get(LI.Code, wh.Code);
                    #endregion OldSchool

                    throw new InvalidOperationException("Wrong amount"); // maybe change approach
                }

                // RoCe: have to do Promos here also ... move stuff from cart to "base"

                // simulation... should be an "else"
                cart.GetFirstShipment().OrderShipmentStatus = OrderShipmentStatus.InventoryAssigned;
                // decrement inventory and let it go
                _inventoryProcessor.AdjustInventoryOrRemoveLineItem(cart.GetFirstShipment()
                                                                    , OrderStatus.Completed, (item, issue) => validationIssues.Add(item, issue));

                // Should do the ClubCard thing here - ClubMembers are logged in
                // PaymentMethodName = "GiftCard"
                if (CustomerContext.Current.CurrentContact != null)
                {
                    // check if GiftCard was used, don't give bonus for that payment
                    IEnumerable <IPayment> giftCardPayment = cart.GetFirstForm().Payments.Where
                                                                 (x => x.PaymentMethodName.Equals("GiftCard"));

                    if (giftCardPayment.Count() >= 1)
                    {
                        ccService.UpdateClubCard(cart, totalProcessedAmount - giftCardPayment.First().Amount);
                    }
                    else
                    {
                        // no GiftCard, but collecting points
                        ccService.UpdateClubCard(cart, totalProcessedAmount);
                    }
                }

                #region OldSchool Inventory check

                //List<InventoryRequestItem> requestItems1 = new List<InventoryRequestItem>(); // holds the "items"
                //InventoryRequestItem requestItem1 = new InventoryRequestItem();

                //// calls for some logic
                //requestItem1.RequestType = InventoryRequestType.Complete; // as a demo
                //requestItem1.OperationKey = reqKey;

                //requestItems1.Add(requestItem1);

                //InventoryRequest inventoryRequest1 = new InventoryRequest(DateTime.UtcNow, requestItems1, null);
                //InventoryResponse inventoryResponse1 = _invService.Service.Request(inventoryRequest1);

                //InventoryRecord rec3 = _invService.Service.Get(LI.Code, wh.Code); // inventory reserved, but not decremented

                #endregion OldSchool

                orderReference = _orderRepository.SaveAsPurchaseOrder(cart);
                _orderRepository.Delete(cart.OrderLink);

                //InventoryRecord rec5 = _invService.Service.Get(LI.Code, wh.Code); // just checking

                scope.Complete();
            } // End Tran

            #endregion

            #region JustChecking

            //Guid custLock;
            //OrderGroupLockManager.IsOrderGroupLocked(orderReference.OrderGroupId, out (Guid)CustomerContext.Current.CurrentContact.PrimaryKeyId));

            /*
             * OrderGroupLockManager.LockOrderGroup(orderReference.OrderGroupId
             *  , (Guid)CustomerContext.Current.CurrentContact.PrimaryKeyId);
             *
             * OrderGroupLockManager.UnlockOrderGroup(orderReference.OrderGroupId);
             */
            #endregion

            // just demoing (Find using this further down)
            purchaseOrder = _orderRepository.Load <IPurchaseOrder>(orderReference.OrderGroupId);

            // check the below
            var theType  = purchaseOrder.OrderLink.OrderType;
            var toString = purchaseOrder.OrderLink.ToString(); // Gets ID and Type ... combined

            #region ThisAndThat - from Fund

            // should do some with OrderStatusManager

            OrderStatus poStatus;
            poStatus = purchaseOrder.OrderStatus;
            //purchaseOrder.OrderStatus = OrderStatus.InProgress;

            //var info = OrderStatusManager.GetPurchaseOrderStatus(PO);

            var shipment = purchaseOrder.GetFirstShipment();
            var status   = shipment.OrderShipmentStatus;

            //shipment. ... no that much to do
            shipment.OrderShipmentStatus = OrderShipmentStatus.InventoryAssigned;

            #region Old-School, but some useful stuff

            //OrderStatusManager.ReleaseOrderShipment(purchaseOrder.GetFirstShipment() as Shipment);
            //OrderStatusManager.ReleaseOrderShipment(PO.OrderForms[0].Shipments[0]); // it gets released
            //OrderStatusManager.HoldOrder(PO); // it gets hold
            //OrderStatusManager.

            // seems to be a DTO involved... don't neeed to set the time like this... could use the new ordernote
            //OrderNotesManager.AddNoteToPurchaseOrder(PO, DateTime.UtcNow.ToShortDateString() + " done some for shipping", OrderNoteTypes.System, CustomerContext.Current.CurrentContactId);

            //            _orderRepository.Save(purchaseOrder); // check if it's like before ... yes it is needed to save again

            #endregion

            var notes = purchaseOrder.Notes; // IOrderNote is 0
            // RoCe - possible BUG
            // PO.OrderNotes works and contain the note above
            //IOrderNote theNewNote =
            Mediachase.Commerce.Orders.OrderNote otherNote = new OrderNote //IOrderNote
            {
                // Created = DateTime.Now, // do we need to set this ?? Nope .ctor does
                CustomerId = new Guid(), // can set this - regarded
                Detail     = "Order ToString(): " + toString + " - Shipment tracking number: " + shipment.ShipmentTrackingNumber,
                LineItemId = purchaseOrder.GetAllLineItems().First().LineItemId,
                // OrderGroupId = 12, R/O - error
                // OrderNoteId = 12, // can define it, but it's disregarded - no error
                Title = "Some title",
                Type  = OrderNoteTypes.Custom.ToString()
            };                                  // bug issued

            purchaseOrder.Notes.Add(otherNote); // void back
            purchaseOrder.ExpirationDate = DateTime.Now.AddMonths(1);


            PurchaseOrder oldPO = (PurchaseOrder)purchaseOrder;
            //oldPO.OrderAddresses.

            // yes, still need to come after adding notes
            _orderRepository.Save(purchaseOrder); // checking down here ... yes it needs to be saved again

            #endregion

            string conLang0 = ContentLanguage.PreferredCulture.Name;
            //string conLang1 = ContentLanguage.PreferredCulture.NativeName;
            //string conLang2 = ContentLanguage.PreferredCulture.TwoLetterISOLanguageName;

            // original shipment, could rewrite and get the dto so it can be used for the second shipment also
            // or grab the dto when loading into the dropdowns
            ShippingMethodDto.ShippingMethodRow theShip =
                ShippingManager.GetShippingMethod(model.SelectedShipId).ShippingMethod.First();

            #region Find & Queue plumbing

            // would be done async...
            if (IsOnLine) // just checking if the below is possible, if we have network access
            {
                // index PO and addresses for BoughtThisBoughtThat & demographic analysis
                IClient     client = Client.CreateFromConfig(); // native
                FindQueries Qs     = new FindQueries(client, true);
                Qs.OrderForFind(purchaseOrder);
            }

            if (poToQueue) // could have better tran-integrity, Extraction later in PO_Extract.sln/Sheduled job
            {
                // ToDo: Put a small portion of data from the PO to msmq, will eventually (out-of-process) go to the ERP
                string       QueueName = ".\\Private$\\MyQueue";
                MessageQueue Q1        = new MessageQueue(QueueName);
                MyMessage    m         = new MyMessage()
                {
                    poNr         = purchaseOrder.OrderNumber,
                    status       = purchaseOrder.OrderStatus.ToString(),
                    orderGroupId = orderReference.OrderGroupId
                };

                Q1.Send(m);
            }

            #endregion

            // Final steps, navigate to the order confirmation page
            StartPage        home = _contentLoader.Get <StartPage>(ContentReference.StartPage);
            ContentReference orderPageReference = home.Settings.orderPage;

            string passingValue = frontEndMessage + paymentProcessResult + " - " + purchaseOrder.OrderNumber;
            return(RedirectToAction("Index", new { node = orderPageReference, passedAlong = passingValue }));
        }
        public CheckoutViewModelFactoryTests()
        {
            var market = new MarketImpl(new MarketId(Currency.USD));

            _cart = new FakeCart(market, Currency.USD);
            _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem());
            _cart.Forms.Single().CouponCodes.Add("couponcode");

            var currentMarketMock   = new Mock <ICurrentMarket>();
            var languageServiceMock = new Mock <LanguageService>(null, null, null);

            currentMarketMock.Setup(x => x.GetCurrentMarket()).Returns(market);
            languageServiceMock.Setup(x => x.GetCurrentLanguage()).Returns(new CultureInfo("en-US"));

            var orderGroupFactoryMock = new Mock <IOrderGroupFactory>();

            orderGroupFactoryMock.Setup(x => x.CreatePayment(It.IsAny <IOrderGroup>())).Returns((IOrderGroup orderGroup) => new FakePayment());
            var serviceLocatorMock = new Mock <IServiceLocator>();

            serviceLocatorMock.Setup(x => x.GetInstance <IOrderGroupFactory>()).Returns(orderGroupFactoryMock.Object);
            ServiceLocator.SetLocator(serviceLocatorMock.Object);

            _addressBookServiceMock = new Mock <IAddressBookService>();
            _addressBookServiceMock.Setup(x => x.List()).Returns(() => new List <AddressModel> {
                new AddressModel {
                    AddressId = "addressid"
                }
            });
            _preferredBillingAddress      = CustomerAddress.CreateInstance();
            _preferredBillingAddress.Name = "preferredBillingAddress";
            _addressBookServiceMock.Setup(x => x.GetPreferredBillingAddress()).Returns(_preferredBillingAddress);
            _addressBookServiceMock.Setup(x => x.UseBillingAddressForShipment()).Returns(true);

            _startPage = new StartPage();
            var contentLoaderMock = new Mock <IContentLoader>();

            contentLoaderMock.Setup(x => x.Get <StartPage>(It.IsAny <PageReference>())).Returns(_startPage);

            var urlResolverMock = new Mock <UrlResolver>();
            var httpcontextMock = new Mock <HttpContextBase>();
            var requestMock     = new Mock <HttpRequestBase>();

            requestMock.Setup(x => x.Url).Returns(new Uri("http://site.com"));
            requestMock.Setup(x => x.UrlReferrer).Returns(new Uri("http://site.com"));
            httpcontextMock.Setup(x => x.Request).Returns(requestMock.Object);

            var marketServiceMock = new Mock <IMarketService>();

            marketServiceMock.Setup(x => x.GetMarket(It.IsAny <MarketId>())).Returns(market);
            var shipmentViewModelFactoryMock = new Mock <ShipmentViewModelFactory>(null, null, null, null, null, marketServiceMock.Object);

            shipmentViewModelFactoryMock.Setup(x => x.CreateShipmentsViewModel(It.IsAny <ICart>())).Returns(() => new[]
            {
                new ShipmentViewModel {
                    CartItems = new[]
                    {
                        new CartItemViewModel {
                            Quantity = 1
                        }
                    }
                }
            });

            _subject = new CheckoutViewModelFactory(
                new MemoryLocalizationService(),
                _addressBookServiceMock.Object,
                contentLoaderMock.Object,
                urlResolverMock.Object,
                (() => httpcontextMock.Object),
                shipmentViewModelFactoryMock.Object,
                null);
        }
예제 #55
0
        public void CannotDeleteStartPage()
        {
            StartPage startPage = new StartPage();

            mocks.Record();
            Expect.On(parser).Call(parser.IsRootOrStartPage(startPage)).Return(true);
            mocks.Replay(parser);

            bool canDelete = integrityManger.CanDelete(startPage);
            Assert.IsFalse(canDelete, "Start page could be deleted");

            mocks.Verify(parser);
        }