private void CreateTestData(NYCLandmarkContext dbContext)
        {
            var i            = 0;
            var boroughs     = EnumHelper.EnumToList <Borough>().Select(e => e.GetDescription());
            var boroughCodes = EnumHelper.EnumToList <Borough>().Select(e => e.GetAttribute <BoroughId>().Value);
            var objectTypes  = EnumHelper.EnumToList <ObjectType>().Select(e => e.GetDescription());

            GenFu.GenFu.Configure <LPCReport>()
            .Fill(l => l.Id, () => ++ i)
            .Fill(l => l.LPNumber, () => string.Format("LP-{0,5:D5}", i))
            .Fill(l => l.LPCId, () => string.Format("{0,5:D5}", i))
            .Fill(l => l.Borough, () => BaseValueGenerator.GetRandomValue(boroughs))
            .Fill(l => l.ObjectType, () => BaseValueGenerator.GetRandomValue(objectTypes));

            var lpcReports = GenFu.GenFu.ListOf <LPCReport>(20);

            dbContext.LPCReports.AddRange(lpcReports);

            var j = 0;

            GenFu.GenFu.Configure <Landmark>()
            .Fill(m => m.Id, () => ++ j)
            .Fill(l => l.LM_TYPE, () => BaseValueGenerator.GetRandomValue(objectTypes))
            .Fill(l => l.BoroughID, () => BaseValueGenerator.GetRandomValue(boroughCodes))
            .Fill(m => m.LP_NUMBER, () => string.Format("LP-{0,5:D5}", j));

            var landmarks = GenFu.GenFu.ListOf <Landmark>(20);

            dbContext.Landmarks.AddRange(landmarks);
            dbContext.SaveChanges();
        }
 public void GetRandomValueFromArray()
 {
     string[] possibleValues = new[] { "A", "B", "C", "D", "E" };
     for (int i = 0; i < 500; i++)
     {
         string randomValue = BaseValueGenerator.GetRandomValue(possibleValues);
         Assert.IsNotNullOrEmpty(randomValue);
         CollectionAssert.Contains(possibleValues, randomValue);
     }
 }
        public void GetRandomValueFromEnumerable()
        {
            IEnumerable <string> possibleValues = (new [] { "1A", "2A", "3A", "4A", "5A" }).Select(s => s);

            for (int i = 0; i < 500; i++)
            {
                string randomValue = BaseValueGenerator.GetRandomValue(possibleValues);
                Assert.IsNotNullOrEmpty(randomValue);
                CollectionAssert.Contains(possibleValues, randomValue);
            }
        }
示例#4
0
 public void GetRandomValueFromArray()
 {
     string[] possibleValues = new[] { "A", "B", "C", "D", "E" };
     for (int i = 0; i < 500; i++)
     {
         string randomValue = BaseValueGenerator.GetRandomValue(possibleValues);
         Assert.NotNull(randomValue);
         Assert.NotEmpty(randomValue);
         Assert.True(possibleValues.Contains(randomValue));
     }
 }
示例#5
0
        public static List <LandmarkModel> GetLandmarkModelList(int count)
        {
            var boroughCodes = EnumHelper.EnumToList <Borough>().Select(e => e.GetAttribute <BoroughIdAttribute>().Value);

            GenFu.GenFu.Configure <LandmarkModel>()
            .Fill(p => p.Name)
            .Fill(p => p.BoroughId, () => BaseValueGenerator.GetRandomValue(boroughCodes))
            .Fill(p => p.Street).AsAddress();

            return(GenFu.GenFu.ListOf <LandmarkModel>(count));
        }
示例#6
0
        public static List <Landmark> GetLandmarkList(int count)
        {
            var boroughCodes = EnumHelper.EnumToList <Borough>().Select(e => e.GetAttribute <BoroughIdAttribute>().Value);

            GenFu.GenFu.Configure <Landmark>()
            .Fill(p => p.LM_NAME)
            .Fill(p => p.BoroughID, () => BaseValueGenerator.GetRandomValue(boroughCodes))
            .Fill(p => p.DESIG_ADDR).AsAddress()
            .Fill(p => p.PLUTO_ADDR).AsAddress();

            return(GenFu.GenFu.ListOf <Landmark>(count));
        }
        public void GetRandomValueFromList()
        {
            List <string> possibleValues = new List <string> {
                "1", "2", "3", "4", "5"
            };

            for (int i = 0; i < 500; i++)
            {
                string randomValue = BaseValueGenerator.GetRandomValue(possibleValues);
                Assert.IsNotNullOrEmpty(randomValue);
                CollectionAssert.Contains(possibleValues, randomValue);
            }
        }
示例#8
0
        public void GetRandomValueFromList()
        {
            List <string> possibleValues = new List <string> {
                "1", "2", "3", "4", "5"
            };

            for (int i = 0; i < 500; i++)
            {
                string randomValue = BaseValueGenerator.GetRandomValue(possibleValues);
                Assert.NotNull(randomValue);
                Assert.NotEmpty(randomValue);
                Assert.True(possibleValues.Contains(randomValue));
            }
        }
示例#9
0
        public static List <LpcReportModel> GetLpcReportModelList(int count)
        {
            var boroughs    = EnumHelper.EnumToList <Borough>().Select(e => e.GetDescription());
            var objectTypes = EnumHelper.EnumToList <ObjectType>().Select(e => e.GetDescription());

            var i = 0;

            GenFu.GenFu.Configure <LpcReportModel>()
            .Fill(l => l.Id, () => ++ i)
            .Fill(l => l.LPNumber, () => $"LP-{i,5:D5}")
            .Fill(l => l.LPCId, () => $"{i,5:D5}")
            .Fill(p => p.Name)
            .Fill(l => l.Borough, () => BaseValueGenerator.GetRandomValue(boroughs))
            .Fill(l => l.ObjectType, () => BaseValueGenerator.GetRandomValue(objectTypes))
            .Fill(p => p.PhotoStatus, true)
            .Fill(p => p.Street).AsAddress();

            return(GenFu.GenFu.ListOf <LpcReportModel>(count));
        }
        private void CreateTestData(NycLandmarkContext dbContext)
        {
            var boroughs    = EnumHelper.EnumToList <Borough>().Select(e => e.GetDescription());
            var objectTypes = EnumHelper.EnumToList <ObjectType>().Select(e => e.GetDescription());

            var i = 0;

            GenFu.GenFu.Configure <LpcReport>()
            .Fill(l => l.Id, () => ++ i)
            .Fill(l => l.LPNumber, () => $"LP-{i,5:D5}")
            .Fill(l => l.LPCId, () => $"{i,5:D5}")
            .Fill(l => l.Borough, () => BaseValueGenerator.GetRandomValue(boroughs))
            .Fill(l => l.ObjectType, () => BaseValueGenerator.GetRandomValue(objectTypes))
            .Fill(l => l.Landmarks);

            _lpcReports = GenFu.GenFu.ListOf <LpcReport>(20);

            dbContext.LPCReports.AddRange(_lpcReports);
            dbContext.SaveChanges();
        }