public void Test_Get_Latest_Version() { //act var directoryService = new DirectoryService(); var fileService = new FileService(); var workspaceService = new WorkspaceService(_traceService, directoryService, fileService); workspaceService.Init(_testConfiguration.WorkspacePath); workspaceService.IncrementMajorVersion(_testConfiguration.WorkspacePath, null); workspaceService.IncrementMinorVersion(_testConfiguration.WorkspacePath, null); workspaceService.IncrementMinorVersion(_testConfiguration.WorkspacePath, null); //assert workspaceService.GetLatestVersion(_testConfiguration.WorkspacePath).ShouldBe("v1.02"); }
public void Test_Get_Baseline_As_Latest_Version() { //arrange var workspace = @"c:\temp\yuniql"; var traceService = new Mock <ITraceService>(); var fileService = new Mock <IFileService>(); var directoryService = new Mock <IDirectoryService>(); directoryService.Setup(s => s.GetDirectories(workspace, "v*.*")).Returns(new string[] { @$ "{workspace}\v0.00" } ); //act var sut = new WorkspaceService(traceService.Object, directoryService.Object, fileService.Object); var latestVersion = sut.GetLatestVersion(workspace); //assert directoryService.Verify(s => s.GetDirectories(workspace, "v*.*")); latestVersion.ShouldBe("v0.00"); }