コード例 #1
0
        public void Should_deploy_all_deltas_for_a_fresh_database()
        {
            var delta1 = new Delta(1L, "C:\\Deltas", "test delta");
            var delta2 = new Delta(2L, "C:\\Deltas", "test delta");

            _deltaRepository.Stub(dr => dr.GetAllDeltas()).Return(new List <Delta>
            {
                delta1,
                delta2
            });
            _deployRepository.Stub(dr => dr.GetLatestDeltaInDatabase()).Return(new NoDelta());


            new Deployer(_deployRepository, _deltaRepository).Deploy();


            _deployRepository.AssertWasCalled(dr => dr.ApplyDelta(delta1));
            _deployRepository.AssertWasCalled(dr => dr.UpdateLatestDeltaAs(delta1));
            _deployRepository.AssertWasCalled(dr => dr.ApplyDelta(delta2));
            _deployRepository.AssertWasCalled(dr => dr.UpdateLatestDeltaAs(delta2));
        }
コード例 #2
0
        public void Should_generate_deploy_script_for_all_deltas_in_right_order_if_from_and_to_are_not_specified()
        {
            var allDeltas = new List <Delta>
            {
                new Delta(2, "", "test delta 2"),
                new Delta(1, "", "test delta 1")
            };

            _deltasRepository.Stub(dr => dr.GetAllDeltas()).Return(allDeltas);
            new Script(_scriptRepository, _deltasRepository).GenerateDeploy();

            var expectedDeltas = new List <Delta>
            {
                new Delta(1, "", "test delta 1"),
                new Delta(2, "", "test delta 2")
            };

            _scriptRepository.AssertWasCalled(dr => dr.GenerateDeployScriptFor(Arg <List <Delta> > .Matches(d => MatchDeltas(d, expectedDeltas))));
        }