public void Creates_negative_values()
        {
            var generator = new TemporaryIntegerValueGenerator<int>();

            Assert.Equal(-1, generator.Next());
            Assert.Equal(-2, generator.Next());
            Assert.Equal(-3, generator.Next());
            Assert.Equal(-4, generator.Next());
            Assert.Equal(-5, generator.Next());
            Assert.Equal(-6, generator.Next());
        }
예제 #2
0
        public void Creates_negative_values()
        {
            var generator = new TemporaryIntegerValueGenerator <int>();

            Assert.Equal(-1, generator.Next());
            Assert.Equal(-2, generator.Next());
            Assert.Equal(-3, generator.Next());
            Assert.Equal(-4, generator.Next());
            Assert.Equal(-5, generator.Next());
            Assert.Equal(-6, generator.Next());
        }
예제 #3
0
        public async Task Creates_negative_values()
        {
            var property  = _model.GetEntityType(typeof(AnEntity)).GetProperty("Id");
            var generator = new TemporaryIntegerValueGenerator();

            Assert.Equal(-1, await generator.NextAsync(property, new DbContextService <DataStoreServices>(() => null)));
            Assert.Equal(-2, await generator.NextAsync(property, new DbContextService <DataStoreServices>(() => null)));
            Assert.Equal(-3, await generator.NextAsync(property, new DbContextService <DataStoreServices>(() => null)));
            Assert.Equal(-4, generator.Next(property, new DbContextService <DataStoreServices>(() => null)));
            Assert.Equal(-5, generator.Next(property, new DbContextService <DataStoreServices>(() => null)));
            Assert.Equal(-6, generator.Next(property, new DbContextService <DataStoreServices>(() => null)));
        }
예제 #4
0
        public void Can_create_values_for_all_integer_types()
        {
            var entityType = _model.GetEntityType(typeof(AnEntity));
            var generator  = new TemporaryIntegerValueGenerator();

            Assert.Equal(-1, generator.Next(entityType.GetProperty("Id")));
            Assert.Equal(-2L, generator.Next(entityType.GetProperty("Long")));
            Assert.Equal((short)-3, generator.Next(entityType.GetProperty("Short")));
            Assert.Equal(unchecked ((byte)-4), generator.Next(entityType.GetProperty("Byte")));
            Assert.Equal((int?)-5, generator.Next(entityType.GetProperty("NullableInt")));
            Assert.Equal((long?)-6, generator.Next(entityType.GetProperty("NullableLong")));
            Assert.Equal((short?)-7, generator.Next(entityType.GetProperty("NullableShort")));
            Assert.Equal(unchecked ((byte?)-8), generator.Next(entityType.GetProperty("NullableByte")));
            Assert.Equal(unchecked ((uint)-9), generator.Next(entityType.GetProperty("UInt")));
            Assert.Equal(unchecked ((ulong)-10), generator.Next(entityType.GetProperty("ULong")));
            Assert.Equal(unchecked ((ushort)-11), generator.Next(entityType.GetProperty("UShort")));
            Assert.Equal((sbyte)-12, generator.Next(entityType.GetProperty("SByte")));
            Assert.Equal(unchecked ((uint?)-13), generator.Next(entityType.GetProperty("NullableUInt")));
            Assert.Equal(unchecked ((ulong?)-14), generator.Next(entityType.GetProperty("NullableULong")));
            Assert.Equal(unchecked ((ushort?)-15), generator.Next(entityType.GetProperty("NullableUShort")));
            Assert.Equal((sbyte?)-16, generator.Next(entityType.GetProperty("NullableSByte")));
        }