Esempio n. 1
0
        public void CanGenerateData_WhenGenerateDataFalse()
        {
            //given
            var columnPOCO = new DateTimeColumnPOCO()
            {
                GenerateData = false
            };

            //then
            Assert.IsFalse(generator.CanGenerateData(columnPOCO));
        }
Esempio n. 2
0
        public void GenerateData_GeneratesExactNumberOfRecords()
        {
            //given
            var columnPOCO = new DateTimeColumnPOCO()
            {
                MinValue = new System.DateTime(2010, 1, 1),
                MaxValue = new System.DateTime(2020, 1, 1)
            };
            var recordsCount = 123;
            //when
            var records = generator.GenerateData(columnPOCO, recordsCount);

            //then
            Assert.AreEqual(recordsCount, records.Count());
        }
        public void DateTimeColumnVM_FromPOCO()
        {
            //given
            var columnPOCO = new DateTimeColumnPOCO()
            {
                MinValue = new DateTime(2000, 1, 1),
                MaxValue = new DateTime(2010, 1, 1)
            };
            //when
            var columnVM = new DateTimeColumnVM(columnPOCO);

            //then
            Assert.AreEqual(columnPOCO.MinValue, columnVM.MinValue);
            Assert.AreEqual(columnPOCO.MaxValue, columnVM.MaxValue);
        }
Esempio n. 4
0
        public void GenerateData_AllAreInSpecifiedRange()
        {
            //given
            var columnPOCO = new DateTimeColumnPOCO()
            {
                MinValue = new System.DateTime(2010, 1, 1),
                MaxValue = new System.DateTime(2020, 1, 1)
            };
            var recordsCount = 123;
            //when
            var records = generator.GenerateData(columnPOCO, recordsCount);

            //then
            foreach (var record in records)
            {
                Assert.IsInstanceOfType(record, typeof(System.DateTime));
                var dateTime = (System.DateTime)record;
                Assert.IsTrue(dateTime <= columnPOCO.MaxValue);
                Assert.IsTrue(dateTime >= columnPOCO.MinValue);
            }
        }
        public void Validate_GenerateDataWhenRequired()
        {
            //given
            var columnPOCO = new DateTimeColumnPOCO()
            {
                Required = true
            };
            var columnVM = new DateTimeColumnVM()
            {
                InternalName = "test column name",
                GenerateData = false,
                MinValue     = new DateTime(2000, 1, 1),
                MaxValue     = new DateTime(2010, 1, 1)
            };

            columnVM.SyncModels(columnPOCO);
            //when
            var validationResults = columnVM.Validate(null);

            //then
            Assert.AreEqual(1, validationResults.Count());
            Assert.IsTrue(validationResults.First().MemberNames.Contains(nameof(DateTimeColumnVM.GenerateData)));
        }