コード例 #1
0
        public void ShouldIgnoreWhenFileNotFound()
        {
            var resolver     = new FileResolver();
            var mockedEditor = new Mock <IFileEditor>();

            mockedEditor.Setup(o => o.Edit(It.IsAny <string>(), It.IsAny <IEnumerable <Release> >()));
            var sut = new Versioner(resolver, mockedEditor.Object);

            sut.ApplyTo("");
            mockedEditor.Verify(o => o.Edit(string.Empty, null), Times.Never);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Provide a path to your solution");
                return;
            }

            var settings  = PlainTextReader.From(args[0] + "\\VersionedFiles.txt").DelimitBy(ColumnDelimiter.Pipe).GetAListOf <VersionedFile>();
            var versioner = new Versioner(new FileResolver(), new FilePropertyEditor(settings));

            versioner.ApplyTo(args[0]);
        }
コード例 #3
0
        public void ShouldApplyVersionToScenario1()
        {
            var settings = new List <VersionedFile>
            {
                new VersionedFile {
                    FileName = "AssemblyInfo.cs",
                    Preffix  = @"[assembly: AssemblyVersion(""",
                    Suffix   = @""")]"
                }
            };
            var sut = new Versioner(new FileResolver(), new FilePropertyEditor(settings));

            sut.ApplyTo(@"..\\..\\scenario1");
        }
コード例 #4
0
        public void ShouldIgnoreWhenEmptyFile()
        {
            var releases       = new Release[0];
            var mockedResolver = new Mock <ISourceResolver>();

            mockedResolver.Setup(o => o.Resolve(It.IsAny <string>())).Returns(releases);
            var mockedEditor = new Mock <IFileEditor>();

            mockedEditor.Setup(o => o.Edit(It.IsAny <string>(), It.IsAny <IEnumerable <Release> >()));
            var sut = new Versioner(mockedResolver.Object, mockedEditor.Object);

            sut.ApplyTo("anyPath");
            mockedEditor.Verify(o => o.Edit(string.Empty, null), Times.Never);
        }
コード例 #5
0
        public void ShouldApplyWhenFileFound()
        {
            var releases = new Release[1] {
                new Release()
            };
            var mockedResolver = new Mock <ISourceResolver>();

            mockedResolver.Setup(o => o.Resolve(It.IsAny <string>())).Returns(releases);
            var mockedEditor = new Mock <IFileEditor>();

            mockedEditor.Setup(o => o.Edit(It.IsAny <string>(), It.IsAny <IEnumerable <Release> >()));
            var sut = new Versioner(mockedResolver.Object, mockedEditor.Object);

            sut.ApplyTo("anyPath");
            mockedEditor.Verify(o => o.Edit("anyPath", releases), Times.Once);
        }