Пример #1
0
        public static Movie GetRandomMovie()
        {
            Movie movie = new Movie
            {
                Title      = "SomeMovieTitle_" + Randomm.RandomAlphaNum(10),
                Director   = "SomeMovieDirector_" + Randomm.RandomAlphaNum(10),
                MainActor  = "SomeMainActor_" + Randomm.RandomAlphaNum(10),
                MovieMaker = "SomeFilmMaker_" + Randomm.RandomAlphaNum(10),
                Year       = Randomm.RandomInt(),
            };

            return(movie);
        }
        public static IAllDataTypesEntity Randomize(IAllDataTypesEntity entity)
        {
            Dictionary <string, long> dictionaryStringLong = new Dictionary <string, long>()
            {
                { "key_" + Randomm.RandomAlphaNum(10), (long)1234321 }
            };
            Dictionary <string, string> dictionaryStringString = new Dictionary <string, string>()
            {
                { "key_" + Randomm.RandomAlphaNum(10), "value_" + Randomm.RandomAlphaNum(10) }
            };
            List <Guid> listOfGuidsType = new List <Guid>()
            {
                Guid.NewGuid(), Guid.NewGuid()
            };
            List <string> listOfStringsType = new List <string>()
            {
                Randomm.RandomAlphaNum(20), Randomm.RandomAlphaNum(12), ""
            };


            entity.StringType           = "StringType_val_" + Randomm.RandomAlphaNum(10);
            entity.GuidType             = Guid.NewGuid();
            entity.DateTimeType         = DateTime.Now.ToUniversalTime();
            entity.NullableDateTimeType = Randomm.RandomInt() % 2 == 0 ? (DateTime?)null : DateTime.UtcNow;
            entity.DateTimeOffsetType   = new DateTimeOffset();
            entity.BooleanType          = false;
            entity.DecimalType          = (decimal)98765432.0;
            entity.DoubleType           = (double)9876543;
            entity.FloatType            = (float)987654;
            entity.NullableIntType      = null;
            entity.IntType                    = 98765;
            entity.Int64Type                  = (Int64)9876;
            entity.TimeUuidType               = TimeUuid.NewId();
            entity.NullableTimeUuidType       = null;
            entity.DictionaryStringLongType   = dictionaryStringLong;
            entity.DictionaryStringStringType = dictionaryStringString;
            entity.ListOfGuidsType            = listOfGuidsType;
            entity.ListOfStringsType          = listOfStringsType;
            return(entity);
        }