예제 #1
0
        public void CreateEvolutionFiles_FileExists()
        {
            const string evolutionName     = "Evolution1";
            const string evolutionContents = "Programatic awesomeness";

            var evolution = new Model.Evolution(evolutionName, DateTime.Now);

            var mockBuilder = new FileContextBuilder()
                              .AddCreateEvolutionFileBehavior()
                              .AddEvolution(evolution.FileName, evolutionContents);

            var repo = new FileRepo(mockBuilder.Context);

            Assert.Throws <EvolutionFileException>(() => repo.CreateEvolutionFile(evolution, evolutionContents));
            Assert.Equal(1, mockBuilder.EvolutionCount);
        }
예제 #2
0
        public void CreateEvolutionFile_Success()
        {
            const string evolutionName     = "Evolution1";
            const string evolutionContents = "Programatic awesomeness";

            var evolution = new Model.Evolution(evolutionName, DateTime.Now);

            var mockBuilder = new FileContextBuilder()
                              .AddCreateEvolutionFileBehavior();

            var repo = new FileRepo(mockBuilder.Context);

            repo.CreateEvolutionFile(evolution, evolutionContents);

            Assert.NotEqual(0, mockBuilder.EvolutionCount);
        }