コード例 #1
0
        public void TestSeveralItemCollection()
        {
            ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();

            coll.MessageFormat = "[user:xyz] posted {0} in [feed:zyx]";
            const int     max = 5;
            StringBuilder sb  = new StringBuilder();

            for (int i = 0; i < max; i++)
            {
                string guid = Guid.NewGuid().ToString();
                if ((i != 0) && (i + 1 < max))
                {
                    sb.Append(coll.Delimiter);
                }
                else if (i != 0)
                {
                    sb.Append(coll.LastDelimiter);
                }
                sb.Append(guid);
                coll.Add(guid);
            }
            string         expected = string.Format(coll.MessageFormat, sb);
            IList <string> strings  = coll.GetAccountAuditStrings();

            Assert.IsNotNull(strings);
            Assert.AreEqual(1, strings.Count);
            Console.WriteLine(strings[0]);
            Assert.AreEqual(expected, strings[0]);
        }
コード例 #2
0
 public void TestEmptyCollection()
 {
     ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();
     IList<string> strings = coll.GetAccountAuditStrings();
     Assert.IsNotNull(strings);
     Assert.AreEqual(0, strings.Count);
 }
コード例 #3
0
    protected override void Application_Start(Object sender, EventArgs e)
    {
        base.Application_Start(sender, e);

        // initialize http nhibernate session
        SnCore.Data.Hibernate.Session.Initialize(true);

        // ProtectAppConfig();

        using (SnCore.Data.Hibernate.Session.OpenConnection())
        {
            CreateDataObjects();
            CreateAdministrator();
            ManagedAccountAuditEntryCollection.SetMaxMessageLength();
        }

        mMailMessageService.Start();
        mTagWordService.Start();
        mSystemReminderService.Start();
        mSystemSyndicationService.Start();
        mThumbnailService.Start();
        mSMTPMessageService.Start();

        WebSystemService system = new WebSystemService();

        EventLogManager.WriteEntry(string.Format("Running with web services {0}.", system.GetVersion()), EventLogEntryType.Information);
    }
コード例 #4
0
        public void TestEmptyCollection()
        {
            ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();
            IList <string> strings = coll.GetAccountAuditStrings();

            Assert.IsNotNull(strings);
            Assert.AreEqual(0, strings.Count);
        }
コード例 #5
0
 public void TestOneItemCollection()
 {
     ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();
     coll.MessageFormat = "[user:xyz] posted {0} in [feed:zyx]";
     coll.Add(Guid.NewGuid().ToString());
     IList<string> strings = coll.GetAccountAuditStrings();
     Assert.IsNotNull(strings);
     Console.WriteLine(strings[0]);
     Assert.AreEqual(1, strings.Count);
 }
コード例 #6
0
 public void TestSetMaxMessageLength()
 {
     using (SnCore.Data.Hibernate.Session.OpenConnection())
     {
         ManagedAccountAuditEntryCollection.SetMaxMessageLength();
         Console.WriteLine("Max length: {0}", ManagedAccountAuditEntryCollection.MaxMessageLength);
         DomainClass dc = SnCore.Data.Hibernate.Session.Model["AccountAuditEntry"];
         Assert.AreEqual(dc["Description"].MaxLengthInChars, ManagedAccountAuditEntryCollection.MaxMessageLength);
     }
 }
コード例 #7
0
        public void TestOneItemCollection()
        {
            ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();

            coll.MessageFormat = "[user:xyz] posted {0} in [feed:zyx]";
            coll.Add(Guid.NewGuid().ToString());
            IList <string> strings = coll.GetAccountAuditStrings();

            Assert.IsNotNull(strings);
            Console.WriteLine(strings[0]);
            Assert.AreEqual(1, strings.Count);
        }
コード例 #8
0
 public void TestMultipleItemCollection()
 {
     ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();
     coll.MessageFormat = "[user:xyz] posted {0} in [feed:zyx]";
     const int max = 23;
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < max; i++)
     {
         string guid = Guid.NewGuid().ToString();
         coll.Add(guid);
     }
     IList<string> strings = coll.GetAccountAuditStrings();
     Assert.IsNotNull(strings);
     foreach (string s in strings)
     {
         Console.WriteLine(s);
         Assert.IsTrue(s.Length < ManagedAccountAuditEntryCollection.MaxMessageLength);
     }
 }
コード例 #9
0
 public void TestSeveralItemCollection()
 {
     ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();
     coll.MessageFormat = "[user:xyz] posted {0} in [feed:zyx]";
     const int max = 5;
     StringBuilder sb = new StringBuilder();
     for (int i = 0; i < max; i++)
     {
         string guid = Guid.NewGuid().ToString();
         if ((i != 0) && (i + 1 < max)) sb.Append(coll.Delimiter);
         else if (i != 0) sb.Append(coll.LastDelimiter);
         sb.Append(guid);
         coll.Add(guid);
     }
     string expected = string.Format(coll.MessageFormat, sb);
     IList<string> strings = coll.GetAccountAuditStrings();
     Assert.IsNotNull(strings);
     Assert.AreEqual(1, strings.Count);
     Console.WriteLine(strings[0]);
     Assert.AreEqual(expected, strings[0]);
 }
コード例 #10
0
        public void TestMultipleItemCollection()
        {
            ManagedAccountAuditEntryCollection coll = new ManagedAccountAuditEntryCollection();

            coll.MessageFormat = "[user:xyz] posted {0} in [feed:zyx]";
            const int     max = 23;
            StringBuilder sb  = new StringBuilder();

            for (int i = 0; i < max; i++)
            {
                string guid = Guid.NewGuid().ToString();
                coll.Add(guid);
            }
            IList <string> strings = coll.GetAccountAuditStrings();

            Assert.IsNotNull(strings);
            foreach (string s in strings)
            {
                Console.WriteLine(s);
                Assert.IsTrue(s.Length < ManagedAccountAuditEntryCollection.MaxMessageLength);
            }
        }