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); }
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]); }
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"); }
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); }
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); }