private IEnumerable <Employee> GetEmployees(DateTime dateTime)
        {
            //stub implementation only:
            var resultCount = RandomValueGenerator.GetRandomInt(1, 100);
            var employees   = new List <Employee>(resultCount);

            for (int index = 0; index < resultCount; index++)
            {
                var employee = new Employee();
                employee.DepartmentName   = RandomValueGenerator.GetRandomString();
                employee.DirectDialNumber = RandomValueGenerator.GetRandomInt(1000000000).ToString();
                employee.EmailAddress     = string.Format("{0}@sixeyed.com", RandomValueGenerator.GetRandomString(10, " "));
                employee.EmployeeId       = RandomValueGenerator.GetRandomInt().ToString();
                employee.Status           = RandomValueGenerator.GetRandomEnumValue <EmployeeStatus>();
                employee.ExtensionNumber  = RandomValueGenerator.GetRandomInt(1000).ToString();
                employee.FaxNumber        = RandomValueGenerator.GetRandomInt(1000000000).ToString();
                employee.FullName         = RandomValueGenerator.GetRandomString(20);
                employee.LatestHireDate   = RandomValueGenerator.GetRandomDateTime(2000);
                employee.LastChangeDate   = RandomValueGenerator.GetRandomDateTime(dateTime.Year - 1);
                employee.MobileNumber     = RandomValueGenerator.GetRandomInt(1000000000).ToString();
                employee.OfficeCountry    = RandomValueGenerator.GetRandomString(15);
                employee.OfficeLocation   = RandomValueGenerator.GetRandomString(30);
                employee.RoleDescription  = RandomValueGenerator.GetRandomString(30);
                employee.RoleTitle        = RandomValueGenerator.GetRandomString(20);
                employees.Add(employee);
            }
            return(employees);
        }
        public void Test_Build_WithPropName_ShouldSetFieldNameEqPropName()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.AreEqual(propertyName, propDef.DatabaseFieldName);
        }
        public void Test_Build_WithAutoIncrementingProp_ShouldSetAsAutoIncrementing()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .IsAutoIncrementing()
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.IsTrue(propDef.AutoIncrementing);
        }
        public void Test_Build_WithKeepValuePrivate_ShouldSetKeepVauePrivate()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .KeepValuePrivate()
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.IsTrue(propDef.KeepValuePrivate);
        }
        public void Test_Build_WithTypeGeneric_ShouldBuildWithTypeNameAndAssembly()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .WithType <Car>()
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual("Car", propDef.PropertyTypeName);
            Assert.AreEqual("TestProject.BO", propDef.PropertyTypeAssemblyName);
        }
        public void Test_Build_WithDescription_ShouldSetDescription()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            string description  = "D" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .WithDescription(description)
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.AreEqual(description, propDef.Description);
        }
        public void Test_Build_WithReadWriteRule_ShouldSetReadWriteRule()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            const PropReadWriteRule propReadWriteRule = PropReadWriteRule.WriteNew;
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .WithReadWriteRule(propReadWriteRule)
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.AreEqual(propReadWriteRule, propDef.ReadWriteRule);
        }
        public void Test_Build_WithAssemblyName_NoTypeName_ShouldBuildWithPropTypeNameEqString()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            string assemblyName = "A" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .WithAssemblyName(assemblyName)
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.AreEqual(assemblyName, propDef.PropertyTypeAssemblyName);
            Assert.AreEqual("String", propDef.PropertyTypeName);
        }
        public void Test_Build_WithPropertyName_ShouldUseDefaults()
        {
            //---------------Set up test pack-------------------
            string propertyName = "P" + RandomValueGenerator.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var propDef = GetPropDefBuilder <Car>()
                          .WithPropertyName(propertyName)
                          .Build();

            //---------------Test Result -----------------------
            Assert.AreEqual(propertyName, propDef.PropertyName);
            Assert.AreEqual("System", propDef.PropertyTypeAssemblyName);
            Assert.AreEqual("String", propDef.PropertyTypeName);
            Assert.AreEqual(PropReadWriteRule.ReadWrite, propDef.ReadWriteRule);
            Assert.AreEqual(propertyName, propDef.DatabaseFieldName);
            Assert.IsNull(propDef.DefaultValueString);
            Assert.IsFalse(propDef.Compulsory);
            Assert.IsFalse(propDef.AutoIncrementing);
            Assert.IsFalse(propDef.KeepValuePrivate);
            Assert.AreEqual(Int32.MaxValue, propDef.Length);
        }
 private static string GetRandomRelName()
 {
     return(RandomValueGenerator.GetRandomString());
 }
Beispiel #11
0
 void RunTimer_OnPulse(PulseEventSource source, ref bool writeLog, ref string logText)
 {
     writeLog = true;
     logText  = "RunTimer_OnPulse, source: {0}, text: {1}"
                .FormatWith(source, RandomValueGenerator.GetRandomString());
 }
 private static PropertiesDefBuilder <T> GetPropertiesDefBuilder <T>() where T : BusinessObject
 {
     return(new PropertiesDefBuilder <T>(new ClassDefBuilder2 <T>(new ClassDefBuilder <T>(), new List <PropDefBuilder <T> >(), new List <string> {
         RandomValueGenerator.GetRandomString()
     }), new List <PropDefBuilder <T> >()));
 }