Example #1
0
 public void AddText_Exception()
 {
     m_MLText = new MLText();
     try
     {
         m_MLText.AddText("ru_", TextRu);
         Assert.Fail();
     }
     catch { }
 }
Example #2
0
        public void Constructor()
        {
            m_MLText = new MLText();
            Assert.IsNotNull(m_MLText);

            m_MLText = new MLText("ru", TextRu);
            Assert.IsNotNull(m_MLText);

            m_MLText = new MLText("ru", TextRu, "en", TextEn);
            Assert.IsNotNull(m_MLText);
        }
Example #3
0
 public void Clear()
 {
     m_MLText = new MLText();
     m_MLText.AddText("ru", TextRu);
     m_MLText.AddText("en", TextEn);
     Assert.IsTrue(m_MLText.ContainsCulture("ru"));
     Assert.IsTrue(m_MLText.ContainsCulture("en"));
     m_MLText.Clear();
     Assert.IsFalse(m_MLText.ContainsCulture("ru"));
     Assert.IsFalse(m_MLText.ContainsCulture("en"));
 }
    private void OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType != DataControlRowType.DataRow)
            return;

        DataRowView rowView = (DataRowView)e.Row.DataItem;
        MLText firstname = new MLText();
        MLText lastname = new MLText();

        firstname.LoadFromXML(rowView["FirstName"].ToString());
        lastname.LoadFromXML(rowView["LastName"].ToString());
        e.Row.Cells[0].Text = string.Format("{0} {1}", firstname, lastname);

        e.Row.Cells[2].Text = (bool)rowView["IsTaken"]
                            ? (string)GetLocalResourceObject("Taken")
                            : (string)GetLocalResourceObject("Granted");
    }
    private void OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType != DataControlRowType.DataRow)
            return;

        DataRowView rowView = (DataRowView)e.Row.DataItem;
        MLText firstname = new MLText();
        MLText lastname = new MLText();

        firstname.LoadFromXML(rowView["OwnerFirstName"].ToString());
        lastname.LoadFromXML(rowView["OwnerLastName"].ToString());
        e.Row.Cells[2].Text = string.Format("{0} {1}", firstname, lastname);

        Image image = e.Row.Cells[0].FindControl("imgType") as Image;
        if (image == null)
            return;

        image.ImageUrl = string.Format("~/Images/RequestObject/reqobj_{0}.png", rowView["ObjType"].ToString());
    }
Example #6
0
        public void OperatorNotEqual_True()
        {
            m_MLText = new MLText();
            Assert.IsTrue(m_MLText != null);
            Assert.IsTrue(null != m_MLText);

            MLText mlt = new MLText();
            mlt["ru"] = TextRu;
            Assert.IsTrue(m_MLText != mlt);

            m_MLText["ru"] = TextEn;
            Assert.IsTrue(m_MLText != mlt);
        }
Example #7
0
        public void OperatorPlusMLText()
        {
            m_MLText = new MLText();
            MLText mlt = m_MLText + (MLText) null;
            Assert.IsNotNull(mlt);
            Assert.AreEqual(mlt, m_MLText);

            mlt = (MLText)null + m_MLText;
            Assert.IsNotNull(mlt);
            Assert.AreEqual(mlt, m_MLText);

            m_MLText["ru"] = TextRu;
            mlt["en"] = TextEn;

            mlt = mlt + m_MLText;
            Assert.AreEqual(TextRu, mlt["ru"]);
            Assert.AreEqual(TextEn, mlt["en"]);

            mlt = new MLText("ru", TextEn);
            mlt = mlt + m_MLText;
            Assert.AreEqual(TextEn + TextRu, mlt["ru"]);
        }
Example #8
0
 public void AddText()
 {
     m_MLText = new MLText();
     m_MLText.AddText("ru", TextRu);
 }
Example #9
0
        public void OperatorNotEqual_False()
        {
            m_MLText = new MLText();
            Assert.IsFalse(m_MLText != m_MLText);

            MLText mlt = new MLText();
            Assert.IsFalse(m_MLText != mlt);

            m_MLText["ru"] = TextRu;
            mlt["ru"] = TextRu;
            Assert.IsFalse(m_MLText != mlt);
        }
Example #10
0
        public void ToXMLString()
        {
            m_MLText = new MLText();
            Assert.AreEqual("<MLText></MLText>", m_MLText.ToXMLString());

            m_MLText["ru"] = TextRu;
            Assert.AreEqual("<MLText><Text lang=\"ru\">" + TextRu + "</Text></MLText>", m_MLText.ToXMLString());
        }
Example #11
0
        public void ContainsCulture_False()
        {
            m_MLText = new MLText();
            m_MLText.AddText("ru", TextRu);
            m_MLText.AddText("en", TextEn);

            Assert.IsFalse(m_MLText.ContainsCulture("fr"));
            Assert.IsFalse(m_MLText.ContainsCulture("en-UK"));
        }
Example #12
0
 public void IndexerSet_Exception()
 {
     m_MLText = new MLText();
     try
     {
         m_MLText["ert"] = TextEn;
         Assert.Fail();
     }
     catch { }
 }
Example #13
0
        public void ToStringTest()
        {
            m_MLText = new MLText();
            Assert.AreEqual(string.Empty, m_MLText.ToString());

            m_MLText["ru"] = TextRu;
            Assert.AreEqual(TextRu, m_MLText.ToString());

            m_MLText["en"] = TextEn;
            Assert.AreEqual(TextEn, m_MLText.ToString());

            string ccID = MLText.CurrentCultureID;

            try
            {
                MLText.CurrentCultureID = "ru";
                Assert.AreEqual(TextRu, m_MLText.ToString());
            }
            finally
            {
                MLText.CurrentCultureID = ccID;
            }
        }
Example #14
0
 public void IndexerGet_Exception()
 {
     m_MLText = new MLText();
     try
     {
         string text = m_MLText["ert"];
         Assert.Fail();
     }
     catch { }
 }
Example #15
0
 public void IndexerSet()
 {
     m_MLText = new MLText();
     m_MLText["ru"] = TextRu;
     m_MLText["en"] = TextEn;
     Assert.IsTrue(m_MLText.ContainsCulture("ru"));
     Assert.IsTrue(m_MLText.ContainsCulture("en"));
 }
Example #16
0
 public void IndexerGet()
 {
     m_MLText = new MLText();
     m_MLText.AddText("ru", TextRu);
     m_MLText.AddText("en", TextEn);
     Assert.AreEqual(TextRu, m_MLText["ru"]);
     Assert.AreEqual(TextEn, m_MLText["en"]);
 }
Example #17
0
        public void GetText()
        {
            m_MLText = new MLText();
            Assert.AreEqual( string.Empty, m_MLText["ru"] );
            Assert.AreEqual(string.Empty, m_MLText["en"]);

            m_MLText["ru"] = TextRu;
            Assert.AreEqual(TextRu, m_MLText["ru"]);
            Assert.AreEqual(TextRu, m_MLText["en"]);

            m_MLText["en"] = TextEn;
            Assert.AreEqual(TextRu, m_MLText["ru"]);
            Assert.AreEqual(TextEn, m_MLText["en"]);
            Assert.AreEqual(TextEn, m_MLText["en-UK"]);

            m_MLText["en-UK"] = TextEnUK;
            Assert.AreEqual(TextRu, m_MLText["ru"]);
            Assert.AreEqual(TextEn, m_MLText["en"]);
            Assert.AreEqual(TextEnUK, m_MLText["en-UK"]);

            string dcID = MLText.DefaultCultureID;
            string ccID = MLText.CurrentCultureID;

            try
            {
                Assert.AreEqual(TextEn, m_MLText["fr"]);

                MLText.CurrentCultureID = "ru";
                Assert.AreEqual(TextRu, m_MLText["fr"]);

                m_MLText.RemoveText("ru");
                Assert.AreEqual(TextEn, m_MLText["fr"]);

                MLText.DefaultCultureID = "en-UK";
                Assert.AreEqual(TextEnUK, m_MLText["fr"]);
            }
            finally
            {
                MLText.CurrentCultureID = ccID;
                MLText.DefaultCultureID = dcID;
            }
        }
Example #18
0
        public void Equals_True()
        {
            m_MLText = new MLText();

            Assert.IsTrue(m_MLText.Equals(m_MLText));

            MLText mlt = new MLText();
            Assert.IsTrue(m_MLText.Equals(mlt));

            m_MLText["ru"] = TextRu;
            mlt["ru"] = TextRu;
            Assert.IsTrue(m_MLText.Equals(mlt));
        }
Example #19
0
        public void OperatorPlusString()
        {
            m_MLText = new MLText();
            MLText mlt = m_MLText + (string)null;
            Assert.IsNotNull(mlt);
            Assert.AreEqual(mlt, m_MLText);

            mlt = (string)null + m_MLText;
            Assert.IsNotNull(mlt);
            Assert.AreEqual(mlt, m_MLText);

            mlt = m_MLText + TextRu;
            Assert.AreEqual(TextRu, mlt[MLText.CurrentCultureID]);
        }
Example #20
0
        public void LoadFromXML()
        {
            m_MLText = new MLText();
            m_MLText["ru"] = TextRu;
            m_MLText["en"] = TextEn;

            MLText mlt = new MLText();
            mlt.LoadFromXML(m_MLText.ToXMLString());

            Assert.AreEqual(TextRu, mlt["ru"]);
            Assert.AreEqual(TextEn, mlt["en"]);

            mlt.LoadFromXML(new MLText().ToXMLString());
            Assert.AreEqual(0, mlt.Cultures.Length);

            mlt.LoadFromXML(TextEnUK);
            Assert.AreEqual(TextEnUK, mlt[MLText.CurrentCultureID]);
        }
Example #21
0
 public void Remove()
 {
     m_MLText = new MLText();
     m_MLText.AddText("ru", TextRu);
     Assert.IsTrue(m_MLText.ContainsCulture("ru"));
     m_MLText.RemoveText("ru");
     Assert.IsFalse(m_MLText.ContainsCulture("ru"));
 }
Example #22
0
        /// <summary>
        /// Updates information about role.
        /// </summary>
        /// <param name="id">Role ID.</param>
        /// <param name="roleID">Role string ID.</param>
        /// <param name="name">Role name.</param>
        /// <param name="description">Role description.</param>
        /// <returns>If record was updated.</returns>
        public static bool UpdateRole( int id, string roleID, MLText name, MLText description )
        {
            RoleDetails details = new RoleDetails();
            details.ID = id;
            details.RoleID = roleID;
            details.Name = name.ToXMLString();
            details.Description = description.ToXMLString();

            return SiteProvider.Roles.UpdateRole( details );
        }
Example #23
0
        public void Cultures()
        {
            m_MLText = new MLText();
            Assert.IsNotNull(m_MLText.Cultures);
            Assert.AreEqual(0, m_MLText.Cultures.Length);

            m_MLText["ru"] = TextRu;
            Assert.IsNotNull(m_MLText.Cultures);
            Assert.AreEqual(1, m_MLText.Cultures.Length);
            Assert.AreEqual("ru", m_MLText.Cultures[0]);

            m_MLText["en"] = TextEn;
            Assert.IsNotNull(m_MLText.Cultures);
            Assert.AreEqual(2, m_MLText.Cultures.Length);

            m_MLText["ru"] = "1" + TextRu;
            Assert.IsNotNull(m_MLText.Cultures);
            Assert.AreEqual(2, m_MLText.Cultures.Length);
        }
Example #24
0
        public void ContainsCultureInvariant_True()
        {
            m_MLText = new MLText();
            m_MLText.AddText("en", TextEn);

            Assert.IsTrue(m_MLText.ContainsCultureInvariant("en"));
            Assert.IsTrue(m_MLText.ContainsCultureInvariant("en-UK"));
        }
Example #25
0
        public void Constructor_Exception()
        {
            try
            {
                m_MLText = new MLText(null, TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText(string.Empty, TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("rus", TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("ru-", TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("u-", TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("ru-s", TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("ru-ert", TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("u-rt", TextRu);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("ru", TextRu, "en");
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("ru-", TextRu, "en", TextEn);
                Assert.Fail();
            }
            catch { }

            try
            {
                m_MLText = new MLText("11-23", TextRu, "en", TextEn);
                Assert.Fail();
            }
            catch { }
        }
Example #26
0
        public void OperatorEqual_True()
        {
            m_MLText = new MLText();
            Assert.IsTrue(m_MLText == m_MLText);

            MLText mlt = new MLText();
            Assert.IsTrue(m_MLText == mlt);

            m_MLText["ru"] = TextRu;
            mlt["ru"] = TextRu;
            Assert.IsTrue(m_MLText == mlt);
        }
Example #27
0
        /// <summary>
        /// Updates information about role.
        /// </summary>
        /// <param name="roleID">Role string ID.</param>
        /// <param name="name">Role name.</param>
        /// <param name="description">Role description.</param>
        /// <returns>If record was created.</returns>
        public static int CreateRole( string roleID, MLText name, MLText description )
        {
            RoleDetails details = new RoleDetails();
            details.RoleID = roleID;
            details.Name = name.ToXMLString();
            details.Description = description.ToXMLString();

            return SiteProvider.Roles.CreateRole( details );
        }
Example #28
0
        public void Equals_False()
        {
            m_MLText = new MLText();
            Assert.IsFalse(m_MLText.Equals(null));

            Assert.IsFalse(m_MLText.Equals(1));

            MLText mlt = new MLText();
            m_MLText["ru"] = TextRu;
            Assert.IsFalse(m_MLText.Equals(mlt));

            mlt["ru"] = TextEn;
            Assert.IsFalse(m_MLText.Equals(mlt));

            mlt["ru"] = TextRu;
            mlt["en"] = TextEn;
            Assert.IsFalse(m_MLText.Equals(mlt));
        }
Example #29
0
        public void OperatorEqual_False()
        {
            m_MLText = new MLText();
            Assert.IsFalse(m_MLText == null);
            Assert.IsFalse(null == m_MLText);

            MLText mlt = new MLText();
            mlt["ru"] = TextRu;
            Assert.IsFalse(m_MLText == mlt);

            m_MLText["ru"] = TextEn;
            Assert.IsFalse(m_MLText == mlt);
        }
Example #30
0
        public void ContainsCultureInvariant_False()
        {
            m_MLText = new MLText();
            m_MLText.AddText("ru", TextRu);
            m_MLText.AddText("en", TextEn);

            Assert.IsFalse(m_MLText.ContainsCultureInvariant("fr"));
            Assert.IsFalse(m_MLText.ContainsCultureInvariant("gm"));
        }