public void Test()
        {
            var mockPacker        = new Mock <IAppxPacker>();
            var mockInteraction   = new Mock <IInteractionService>();
            var mockCreator       = new Mock <IAppxManifestCreator>();
            var mockConfiguration = new Mock <IConfigurationService>();
            var mockSigning       = new Mock <ISigningManager>();
            var mockManager       = new Mock <ISelfElevationProxyProvider <ISigningManager> >();
            var mockTimeStampFeed = new Mock <ITimeStampFeed>();

            mockManager.Setup(dep => dep.GetProxyFor(It.IsAny <SelfElevationLevel>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(mockSigning.Object));

            var config = new Configuration();

            mockConfiguration.Setup(dep => dep.GetCurrentConfiguration(false)).Returns(config);
            mockConfiguration.Setup(dep => dep.GetCurrentConfiguration(true)).Returns(config);
            mockSigning.Setup(dep => dep.GetCertificatesFromStore(It.IsAny <CertificateStoreType>(), It.IsAny <bool>(),
                                                                  It.IsAny <CancellationToken>(), It.IsAny <IProgress <ProgressData> >()))
            .ReturnsAsync(new List <PersonalCertificate>());

            var viewModel = new PackViewModel(mockManager.Object, mockCreator.Object, mockConfiguration.Object, mockInteraction.Object, mockTimeStampFeed.Object);

            Assert.IsFalse(viewModel.HasError);
            Assert.IsFalse(viewModel.IsValid);

            viewModel.OkCommand.Execute(null);
            Assert.IsTrue(viewModel.HasError);

            Assert.IsTrue(string.IsNullOrEmpty(viewModel.OutputPath.CurrentValue));
            viewModel.InputPath.CurrentValue = @"c:\myFolder\temp123";
            Assert.AreEqual(@"c:\myFolder\temp123.msix", viewModel.OutputPath.CurrentValue);
        }
Exemplo n.º 2
0
        public AddPackView(PackViewModel packViewModel)
        {
            InitializeComponent();

            _viewModel = packViewModel;

            DataContext = _viewModel;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Shows add pack dialog
        /// </summary>
        public PackModel ShowAddPackDialog()
        {
            ModalDialog modalDialog = new ModalDialog();

            if (_parentWindow != null)
            {
                modalDialog.Owner = _parentWindow;
            }

            PackViewModel packViewModel = new PackViewModel(new PackModel());

            packViewModel.InitializePackOptions();
            AddPackView addPackView = new AddPackView(packViewModel);

            modalDialog.WindowTitle  = "Add Pack";
            modalDialog.Body         = addPackView;
            modalDialog.Confirmation = addPackView.ViewModel;

            bool?result = ShowDialog(modalDialog);

            return(result == true ? addPackView.ViewModel.PackModel : null);
        }
Exemplo n.º 4
0
        public ActionResult Create(PackViewModel AVM)
        {
            try
            {
                // TODO: Add insert logic here
                Pack A = new Pack();
                A.Id              = AVM.Id;
                A.date_deb        = AVM.date_deb;
                A.date_expiration = AVM.date_expiration;
                A.ListPanier      = AVM.ListPanierModel;
                A.ListProduct     = AVM.ListProduct;
                A.Price           = AVM.Price;

                PackService.Add(A);
                PackService.Commit();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }