Пример #1
0
        private void CreateMetadata(int parentId)
        {
            try
            {
                string name      = NameTextBox.Text;
                string reference = ExternalRefTextBox.Text;
                string synonyms  = SynonymsTextBox.Text;

                Metadata o = MetadataManager.Add(name, parentId, BrandId, GroupNumber, reference, synonyms, CurrentUser);

                MetadataIdTextBox.Value = o.MetadataId.ToString();
                MessageLabel1.SetSuccessMessage("metadata created successfully");
            }
            catch (BaseEntityException <Metadata> ex)
            {
                if (ex.Errors.Count > 0)
                {
                    MessageLabel1.SetErrorMessage("Unable to create metadata; The following errors occured:", ex.Errors);
                }
                else
                {
                    MessageLabel1.SetErrorMessage(ex.Message);
                }
            }
            catch (Exception ex)
            {
                m_Logger.Fatal(string.Format("Error creating metadata with parent id: {0}", parentId), ex);
                MessageLabel1.SetErrorMessage("An unhandled error occured", ex.ToString());
            }
        }
Пример #2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            s_metadataManager = new MetadataManager(AppBaseFolder);

            // Adding data, 5 items in total
            for (int a = 1; a <= 5; ++a)
            {
                var metadataOut = GetMetadataForTest(a);
                s_metadataManager.Add(metadataOut);
            }
        }
Пример #3
0
        public void Err_Add_TimeNotUtc()
        {
            // Testing the detection of non-UTC timestamps

            AssertArgumentException("DateTime kind must be UTC",
                                    () =>
            {
                var metadata = new Metadata("host", "exc", "topic",
                                            DateTime.Now.ToLocalTime(), "name", "payload", PayloadTypeType.Other, "path");
                s_metadataManager.Add(metadata);
            });
        }