示例#1
0
        public void CreateId_uses_invariant_calendar()
        {
            var invariantYear = CultureInfo.InvariantCulture.Calendar.GetYear(DateTime.Today).ToString();

            var id = new MigrationsIdGenerator().GenerateId("Zecora");

            Assert.StartsWith(invariantYear, id);
        }
        public void CreateId_always_increments_timestamp()
        {
            var generator = new MigrationsIdGenerator();

            var id1 = generator.GenerateId("Rainbow");
            var id2 = generator.GenerateId("Rainbow");

            Assert.NotEqual(id1, id2);
        }
示例#3
0
        public void CreateId_always_increments_timestamp()
        {
            var generator = new MigrationsIdGenerator();

            var id1 = generator.GenerateId("Rainbow");
            var id2 = generator.GenerateId("Rainbow");

            Assert.NotEqual(id1, id2);
        }
示例#4
0
        public void IsValidId_returns_false_when_supplied_format_is_too_short()
        {
            var valid = new MigrationsIdGenerator().IsValidId("1234567890123_InitialCreate");

            Assert.False(valid);
        }
示例#5
0
        public void IsValidId_returns_false_when_invalid()
        {
            var valid = new MigrationsIdGenerator().IsValidId("Rarity");

            Assert.False(valid);
        }
示例#6
0
        public void IsValidId_returns_true_when_valid()
        {
            var valid = new MigrationsIdGenerator().IsValidId("20150302100930_Rarity");

            Assert.True(valid);
        }
示例#7
0
        public void GetName_works()
        {
            var name = new MigrationsIdGenerator().GetName("20150302100620_Apple");

            Assert.Equal("Apple", name);
        }
示例#8
0
        public void CreateId_works()
        {
            var id = new MigrationsIdGenerator().GenerateId("Twilight");

            Assert.Matches("[0-9]{14}_Twilight", id);
        }
        public void IsValidId_returns_false_when_invalid()
        {
            var valid = new MigrationsIdGenerator().IsValidId("Rarity");

            Assert.False(valid);
        }
        public void IsValidId_returns_true_when_valid()
        {
            var valid = new MigrationsIdGenerator().IsValidId("20150302100930_Rarity");

            Assert.True(valid);
        }
        public void GetName_works()
        {
            var name = new MigrationsIdGenerator().GetName("20150302100620_Apple");

            Assert.Equal("Apple", name);
        }
        public void CreateId_works()
        {
            var id = new MigrationsIdGenerator().GenerateId("Twilight");

            Assert.Matches("[0-9]{14}_Twilight", id);
        }