using umbraco.cms.businesslogic.propertytype; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using umbraco.interfaces; using umbraco.cms.businesslogic.datatype; using umbraco.cms.businesslogic; using System.Linq; using umbraco.cms.businesslogic.web; namespace umbraco.Test { /// ///This is a test class for PropertyTypeTest and is intended ///to contain all PropertyTypeTest Unit Tests /// [TestClass()] public class PropertyTypeTest { /// ///A test for MakeNew /// [TestMethod()] public void PropertyType_Make_New() { var allDataTypes = DataTypeDefinition.GetAll().ToList(); //get all definitions var contentTypes = DocumentType.GetAllAsList(); var name = "TEST" + Guid.NewGuid().ToString("N"); var pt = PropertyType.MakeNew(allDataTypes.First(), contentTypes.First(), name, name); Assert.IsTrue(pt.Id > 0); Assert.IsInstanceOfType(pt, typeof(PropertyType)); pt.delete(); //make sure it's gone Assert.IsFalse(PropertyType.GetAll().Select(x => x.Id).Contains(pt.Id)); } #region Tests to write ///// /////A test for PropertyType Constructor ///// //[TestMethod()] //public void PropertyTypeConstructorTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // Assert.Inconclusive("TODO: Implement code to verify target"); //} ///// /////A test for GetAll ///// //[TestMethod()] //public void GetAllTest() //{ // PropertyType[] expected = null; // TODO: Initialize to an appropriate value // PropertyType[] actual; // actual = PropertyType.GetAll(); // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for GetEditControl ///// //[TestMethod()] //public void GetEditControlTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // object Value = null; // TODO: Initialize to an appropriate value // bool IsPostBack = false; // TODO: Initialize to an appropriate value // IDataType expected = null; // TODO: Initialize to an appropriate value // IDataType actual; // actual = target.GetEditControl(Value, IsPostBack); // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for GetPropertyType ///// //[TestMethod()] //public void GetPropertyTypeTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType expected = null; // TODO: Initialize to an appropriate value // PropertyType actual; // actual = PropertyType.GetPropertyType(id); // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for GetRawDescription ///// //[TestMethod()] //public void GetRawDescriptionTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // string expected = string.Empty; // TODO: Initialize to an appropriate value // string actual; // actual = target.GetRawDescription(); // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for GetRawName ///// //[TestMethod()] //public void GetRawNameTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // string expected = string.Empty; // TODO: Initialize to an appropriate value // string actual; // actual = target.GetRawName(); // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for Save ///// //[TestMethod()] //public void SaveTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // target.Save(); // Assert.Inconclusive("A method that does not return a value cannot be verified."); //} ///// /////A test for delete ///// //[TestMethod()] //public void deleteTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // target.delete(); // Assert.Inconclusive("A method that does not return a value cannot be verified."); //} ///// /////A test for Alias ///// //[TestMethod()] //public void AliasTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // string expected = string.Empty; // TODO: Initialize to an appropriate value // string actual; // target.Alias = expected; // actual = target.Alias; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for ContentTypeId ///// //[TestMethod()] //public void ContentTypeIdTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // int actual; // actual = target.ContentTypeId; // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for DataTypeDefinition ///// //[TestMethod()] //public void DataTypeDefinitionTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // DataTypeDefinition expected = null; // TODO: Initialize to an appropriate value // DataTypeDefinition actual; // target.DataTypeDefinition = expected; // actual = target.DataTypeDefinition; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for Description ///// //[TestMethod()] //public void DescriptionTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // string expected = string.Empty; // TODO: Initialize to an appropriate value // string actual; // target.Description = expected; // actual = target.Description; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for Id ///// //[TestMethod()] //public void IdTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // int actual; // actual = target.Id; // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for Mandatory ///// //[TestMethod()] //public void MandatoryTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // bool expected = false; // TODO: Initialize to an appropriate value // bool actual; // target.Mandatory = expected; // actual = target.Mandatory; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for Name ///// //[TestMethod()] //public void NameTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // string expected = string.Empty; // TODO: Initialize to an appropriate value // string actual; // target.Name = expected; // actual = target.Name; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for SortOrder ///// //[TestMethod()] //public void SortOrderTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // int expected = 0; // TODO: Initialize to an appropriate value // int actual; // target.SortOrder = expected; // actual = target.SortOrder; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for TabId ///// //[TestMethod()] //public void TabIdTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // int expected = 0; // TODO: Initialize to an appropriate value // int actual; // target.TabId = expected; // actual = target.TabId; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} ///// /////A test for ValidationRegExp ///// //[TestMethod()] //public void ValidationRegExpTest() //{ // int id = 0; // TODO: Initialize to an appropriate value // PropertyType target = new PropertyType(id); // TODO: Initialize to an appropriate value // string expected = string.Empty; // TODO: Initialize to an appropriate value // string actual; // target.ValidationRegExp = expected; // actual = target.ValidationRegExp; // Assert.AreEqual(expected, actual); // Assert.Inconclusive("Verify the correctness of this test method."); //} #endregion #region Initialize and cleanup // //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion } }