public void Create_and_initialize_operation()
        {
            var sequence = new Sequence("dbo.MySequence");
            var createSequenceOperation = new CreateSequenceOperation(sequence);

            Assert.Same(sequence, createSequenceOperation.Sequence);
            Assert.False(createSequenceOperation.IsDestructiveChange);
        }
예제 #2
0
        public void Clone_replicates_instance()
        {
            var sequence = new Sequence("dbo.MySequence", "int", 5, 2);
            var clone = sequence.Clone(new CloneContext());

            Assert.NotSame(sequence, clone);
            Assert.Equal("dbo.MySequence", clone.Name);
            Assert.Equal("int", clone.DataType);
            Assert.Equal(5, clone.StartWith);
            Assert.Equal(2, clone.IncrementBy);
        }
예제 #3
0
        public void GetSequence_finds_sequence_by_name()
        {
            var database = new DatabaseModel();
            var sequence0 = new Sequence("dbo.MySequence0");
            var sequence1 = new Sequence("dbo.MySequence1");

            database.AddSequence(sequence0);
            database.AddSequence(sequence1);

            Assert.Same(sequence0, database.GetSequence("dbo.MySequence0"));
            Assert.Same(sequence1, database.GetSequence("dbo.MySequence1"));
        }
예제 #4
0
        public void AddSequence_adds_specified_sequence()
        {
            var database = new DatabaseModel();

            Assert.Equal(0, database.Sequences.Count);

            var sequence = new Sequence("dbo.MySequence");
            database.AddSequence(sequence);

            Assert.Equal(1, database.Sequences.Count);
            Assert.Same(sequence, database.Sequences[0]);
        }
예제 #5
0
        public void Sequences_gets_read_only_list_of_sequences()
        {
            var database = new DatabaseModel();
            var sequence0 = new Sequence("dbo.MySequence0");
            var sequence1 = new Sequence("dbo.MySequence1");

            database.AddSequence(sequence0);
            database.AddSequence(sequence1);

            Assert.IsAssignableFrom<IReadOnlyList<Sequence>>(database.Sequences);
            Assert.Equal(2, database.Sequences.Count);
            Assert.Same(sequence0, database.Sequences[0]);
            Assert.Same(sequence1, database.Sequences[1]);
        }
예제 #6
0
        public void RemoveSequence_removes_specified_sequence()
        {
            var database = new DatabaseModel();
            var sequence0 = new Sequence("dbo.MySequence0");
            var sequence1 = new Sequence("dbo.MySequence1");

            database.AddSequence(sequence0);
            database.AddSequence(sequence1);

            Assert.Equal(2, database.Sequences.Count);

            database.RemoveSequence("dbo.MySequence1");

            Assert.Equal(1, database.Sequences.Count);
            Assert.Same(sequence0, database.Sequences[0]);
        }
예제 #7
0
        public void Create_and_initialize_sequence()
        {
            var sequence = new Sequence("dbo.MySequence");

            Assert.Equal("dbo.MySequence", sequence.Name);
            Assert.Equal("BIGINT", sequence.DataType);
            Assert.Equal(0, sequence.StartWith);
            Assert.Equal(1, sequence.IncrementBy);

            var sequence2 = new Sequence("dbo.MySequence2", "int", 5, 2);

            Assert.Equal("dbo.MySequence2", sequence2.Name);
            Assert.Equal("int", sequence2.DataType);
            Assert.Equal(5, sequence2.StartWith);
            Assert.Equal(2, sequence2.IncrementBy);
        }
예제 #8
0
        public void Clone_replicates_tables()
        {            
            var databaseModel = new DatabaseModel();
            var sequence0 = new Sequence("dbo.S0");
            var sequence1 = new Sequence("dbo.S1");
            var table0 = new Table("dbo.T0");
            var table1 = new Table("dbo.T1");

            databaseModel.AddSequence(sequence0);
            databaseModel.AddSequence(sequence1);
            databaseModel.AddTable(table0);
            databaseModel.AddTable(table1);

            var clone = databaseModel.Clone();

            Assert.NotSame(databaseModel, clone);
            Assert.Equal(2, clone.Sequences.Count);
            Assert.NotSame(sequence0, clone.Sequences[0]);
            Assert.NotSame(sequence1, clone.Sequences[1]);
            Assert.Equal("dbo.S0", clone.Sequences[0].Name);
            Assert.Equal("dbo.S1", clone.Sequences[1].Name);
            Assert.Equal(2, clone.Tables.Count);
            Assert.NotSame(table0, clone.Tables[0]);
            Assert.NotSame(table1, clone.Tables[1]);
            Assert.Equal("dbo.T0", clone.Tables[0].Name);
            Assert.Equal("dbo.T1", clone.Tables[1].Name);
        }
        public CreateSequenceOperation([NotNull] Sequence sequence)
        {
            Check.NotNull(sequence, "sequence");

            _sequence = sequence;
        }