public void LoadResources_MigrateOldTests_DirecotoryExists_True() { //------------------Arrange--------------- const string resourceDirectory = "Resources - ServerTests"; var mockWriter = new Mock <IWriter>(); var mockDirectory = new Mock <IDirectory>(); var mockResourceCatalog = new Mock <IResourceCatalog>(); var mockResourceCatalogFactory = new Mock <IResourceCatalogFactory>(); mockDirectory.Setup(o => o.Exists(It.IsAny <string>())).Returns(true); mockResourceCatalogFactory.Setup(o => o.New()).Returns(mockResourceCatalog.Object); //------------------Act------------------- var loadResources = new LoadResources(resourceDirectory, mockWriter.Object, mockDirectory.Object, mockResourceCatalogFactory.Object); loadResources.MigrateOldTests(); //------------------Assert---------------- mockDirectory.Verify(o => o.Copy(It.IsAny <string>(), It.IsAny <string>(), true), Times.Never); mockDirectory.Verify(o => o.CleanUp(It.IsAny <string>()), Times.Never); }
public void LoadResources_MigrateOldTests_DirecotoryExists_False() { //------------------Arrange--------------- const string resourceDirectory = "Resources - ServerTests"; var mockWriter = new Mock <IWriter>(); var mockDirectory = new Mock <IDirectory>(); var mockResourceCatalog = new Mock <IResourceCatalog>(); var mockResourceCatalogFactory = new Mock <IResourceCatalogFactory>(); mockDirectory.Setup(o => o.Exists(EnvironmentVariables.TestPath)).Returns(false); mockDirectory.Setup(o => o.Exists(Path.Combine(EnvironmentVariables.ApplicationPath, "Tests"))).Returns(true); mockResourceCatalogFactory.Setup(o => o.New()).Returns(mockResourceCatalog.Object); //------------------Act------------------- var loadResources = new LoadResources(resourceDirectory, mockWriter.Object, mockDirectory.Object, mockResourceCatalogFactory.Object); loadResources.MigrateOldTests(); //------------------Assert---------------- mockDirectory.Verify(o => o.Copy(It.IsAny <string>(), It.IsAny <string>(), true), Times.Once); mockDirectory.Verify(o => o.CleanUp(It.IsAny <string>()), Times.Once); }