public void Data_EntityReader_CountAny()
        {
            var reader = new ValueReader <CustomerType>();

            // GetAll() count and any
            var resultsAll = reader.GetAll();

            Assert.IsTrue(resultsAll.Count() > 0);
            Assert.IsTrue(resultsAll.Any());

            // GetAll().Take(1) count and any
            var resultsTake = reader.GetAll().Take(1);

            Assert.IsTrue(resultsTake.Count() == 1);
            Assert.IsTrue(resultsTake.Any());

            // Get an Id to test
            var key = reader.GetAllExcludeDefault().FirstOrDefaultSafe().Key;

            Assert.IsTrue(key != TypeExtension.DefaultGuid);

            // GetAll().Where count and any
            var resultsWhere = reader.GetAll().Where(x => x.Key == key);

            Assert.IsTrue(resultsWhere.Count() > 0);
            Assert.IsTrue(resultsWhere.Any());
        }
        public void Data_EntityReader_GetByKey()
        {
            var reader = new ValueReader <CustomerType>();

            // ByKey Should return 1 record
            var existingKey  = reader.GetAll().FirstOrDefaultSafe().Key;
            var custWhereKey = reader.GetAll().Where(x => x.Key == existingKey);

            Assert.IsTrue(custWhereKey.Count() > 0);
        }
Example #3
0
        public void Core_Data_ValueReader_GetByKey()
        {
            var custData = new ValueReader <CustomerType>(new ConnectionStringFactory().GetDefaultConnection());

            // ByKey Should return 1 record
            var existingKey  = custData.GetAll().FirstOrDefaultSafe().Key;
            var custWhereKey = custData.GetAll().Where(x => x.Key == existingKey);

            Assert.IsTrue(custWhereKey.Count() > 0);
        }
Example #4
0
        public async Task Flow_FlowInfo()
        {
            var workflow = new FlowInfo();
            var flowKey  = Defaults.Guid;
            var reader   = new ValueReader <FlowInfo>();

            workflow = reader.GetAll().FirstOrDefaultSafe();
            Assert.IsTrue(workflow.Key != Defaults.Guid, "FlowInfo didnt work");

            flowKey  = reader.GetAll().FirstOrDefaultSafe().Key;
            workflow = reader.GetByKey(flowKey);
            Assert.IsTrue(workflow.Key != Defaults.Guid, "FlowInfo didnt work");
        }
        public void Data_EntityReader_GetAll()
        {
            var reader      = new ValueReader <CustomerType>();
            var typeResults = reader.GetAll().Take(1);

            Assert.IsTrue(typeResults.Count() > 0);
        }
Example #6
0
        public async Task Option_OptionInfo_Get()
        {
            var reader     = new ValueReader <OptionInfo>();
            var ItemToTest = new OptionInfo();

            ItemToTest = reader.GetAll().FirstOrDefaultSafe();
            Assert.IsTrue(ItemToTest != null, "Item constructed and did not fail.");
        }
Example #7
0
 public void Core_Data_ValueReader_GetAll()
 {
     using (var typeDB = new ValueReader <CustomerType>(new ConnectionStringFactory().GetDefaultConnection()))
     {
         var typeResults = typeDB.GetAll().Take(1);
         Assert.IsTrue(typeResults.Count() > 0);
     }
 }
        public void Data_EntityReader_GetWhere()
        {
            // Plain EntityInfo object
            var reader   = new ValueReader <CustomerType>();
            var testType = new CustomerType();
            var testKey  = reader.GetAllExcludeDefault().FirstOrDefaultSafe().Key;

            testType = reader.GetAll().Where(x => x.Key == testKey).FirstOrDefaultSafe();
            Assert.IsTrue(testType.Key != TypeExtension.DefaultGuid);
        }
Example #9
0
        public async Task Application_Settings()
        {
            var Apps   = new List <ApplicationSetting>();
            var App    = new ApplicationSetting();
            var reader = new ValueReader <ApplicationSetting>();

            //
            // Test GetAll()
            //
            App = reader.GetAll().FirstOrDefaultSafe();
            Assert.IsTrue(App != null, "Class constructed and data access did not throw exception.");
        }
        public void Data_EntityReader_GetById()
        {
            var reader     = new ValueReader <CustomerType>();
            var custEntity = new CustomerType();

            // ById Should return 1 record
            var existingKey  = reader.GetAllExcludeDefault().FirstOrDefaultSafe().Key;
            var custWhereKey = reader.GetAll().Where(x => x.Key == existingKey);

            Assert.IsTrue(custWhereKey.Count() > 0);
            Assert.IsTrue(custWhereKey.Any());

            custEntity = custWhereKey.FirstOrDefaultSafe();
            Assert.IsTrue(custEntity.Key != TypeExtension.DefaultGuid);
        }
Example #11
0
        public void Core_Data_ValueReader_CountAny()
        {
            using (var db = new ValueReader <CustomerType>(new ConnectionStringFactory().GetDefaultConnection()))
            {
                // GetAll() count and any
                var resultsAll = db.GetAll();
                Assert.IsTrue(resultsAll.Count() > 0);
                Assert.IsTrue(resultsAll.Any());

                // GetAll().Take(1) count and any
                var resultsTake = db.GetAll().Take(1);
                Assert.IsTrue(resultsTake.Count() == 1);
                Assert.IsTrue(resultsTake.Any());

                // Get an Id to test
                var key = db.GetAllExcludeDefault().FirstOrDefaultSafe().Key;
                Assert.IsTrue(key != Guid.Empty);

                // GetAll().Where count and any
                var resultsWhere = db.GetAll().Where(x => x.Key == key);
                Assert.IsTrue(resultsWhere.Count() > 0);
                Assert.IsTrue(resultsWhere.Any());
            }
        }
Example #12
0
        public async Task Application_ApplicationInfo()
        {
            var apps    = new List <ApplicationInfo>();
            var app     = new ApplicationInfo();
            var itemKey = Defaults.Guid;
            var reader  = new ValueReader <ApplicationInfo>();

            //
            // Pull all
            //
            apps = reader.GetAll().ToList();
            Assert.IsTrue(apps.Count > 0, "All didnt get from database.");
            //
            // Pull one
            //
            itemKey = apps.FirstOrDefaultSafe().Key;
            app     = reader.GetByKey(itemKey);
            Assert.IsTrue(app.Key != Defaults.Guid, "All didnt get from database.");
        }
        /// <summary>
        /// Gets all records that exactly equal passed name
        /// </summary>
        /// <param name="name">Value to search CustomerTypeName field </param>
        /// <returns>All records matching the passed name</returns>
        public static IQueryable <CustomerType> GetByName(string name)
        {
            var reader = new ValueReader <CustomerType>();

            return(reader.GetAll().Where(x => x.Name == name));
        }