Esempio n. 1
0
        protected void cmbExistingApplication_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Hide selection panels if we don't need them
            pnlBody.Visible = ((ApplicationItemType)cmbExistingApplication.SelectedIndex != ApplicationItemType.AllApplications);

            ApplicationItemType applicationType = (ApplicationItemType)cmbExistingApplication.SelectedIndex;

            SelectedApplication = applicationType != ApplicationItemType.AllApplications && applicationType != ApplicationItemType.NewApplication ? (IApplication)cmbExistingApplication.SelectedItem : null;
        }
Esempio n. 2
0
        public void SaveApplication_ShouldAddApplication_WhenIdIs0(ApplicationItemType itemType)
        {
            // Arrange
            var parentId = _applicationService.SaveApplication(
                new ApplicationSaveModel
            {
                Arguments   = "Arguments",
                Description = "Description",
                Name        = "Name",
                Path        = "Path",
                ItemType    = ApplicationItemType.Folder
            });

            var applicationIds = new List <int>();

            // Act
            for (var i = 0; i < 3; i++)
            {
                applicationIds.Add(_applicationService.SaveApplication(
                                       new ApplicationSaveModel
                {
                    Arguments   = $"Arguments{i}",
                    Description = $"Description{i}",
                    Name        = $"Name{i}",
                    Path        = $"Path{i}",
                    ItemType    = itemType,
                    ParentId    = parentId
                }));
            }

            // Assert
            for (var i = 0; i < applicationIds.Count; i++)
            {
                var id          = applicationIds[i];
                var application = _liteDbContext.Applications.GetById(id);

                Assert.AreEqual($"Arguments{i}", application.Arguments);
                Assert.AreEqual($"Description{i}", application.Description);
                Assert.AreEqual($"Name{i}", application.Name);
                Assert.AreEqual($"Path{i}", application.Path);
                Assert.AreEqual(itemType, application.ItemType);
                Assert.AreEqual(parentId, application.ParentId);
                Assert.AreEqual(i + 1, application.SortOrder);
            }
        }