public void Create_TargetPathPostFixDefined_TargetPathGetsExtended() { var fixture = new EndpointCreatorFixture(new[] { new Model.Endpoint { Id = "SomeEndpoint", Directories = new[] { new Directory { SourcePath = "/Working/Source/Sourcedirectory1", TargetPath = "Target/Subtarget1/" }, new Directory { SourcePath = "/Working/Source/Sourcedirectory2", TargetPath = "Target/Subtarget2/" } } } }); fixture.FileSystem.CreateDirectory("/Working/Source"); fixture.FileSystem.CreateDirectory("/Working/Source/Sourcedirectory1"); fixture.FileSystem.CreateFile("/Working/Source/Sourcedirectory1/Sourcefile1.txt"); fixture.FileSystem.CreateDirectory("/Working/Source/Sourcedirectory2"); fixture.FileSystem.CreateFile("/Working/Source/Sourcedirectory2/Sourcefile2.txt"); fixture.FileSystem.CreateDirectory("/Working/Source/Sourcedirectory2/Subsourcedirectory"); fixture.FileSystem.CreateFile("/Working/Source/Sourcedirectory2/Subsourcedirectory/Subsourcefile.txt"); EndpointCreatorSettings settings = new EndpointCreatorSettings { TargetPathPostFix = "SomeTargetPathPostFix" }; var result = Record.Exception(() => fixture.Run(settings)); Assert.Null(result); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpointSomeTargetPathPostFix/Target/Subtarget1/Sourcefile1.txt").Exists); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpointSomeTargetPathPostFix/Target/Subtarget2/Sourcefile2.txt").Exists); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpointSomeTargetPathPostFix/Target/Subtarget2/Subsourcedirectory/Subsourcefile.txt").Exists); }
public void Create_BuildConfigurationDefined_SubstitutesSourcePaths() { var fixture = new EndpointCreatorFixture(new[] { new Model.Endpoint { Id = "SomeEndpoint", Directories = new[] { new Directory { SourcePath = "/Working/Source/[BuildConfiguration]", TargetPath = "Target/Subtarget1/" }, new Directory { SourcePath = "/Working/Source/Sourcedirectory2", TargetPath = "Target/Subtarget2/" } } } }); fixture.FileSystem.CreateDirectory("/Working/Source"); fixture.FileSystem.CreateDirectory("/Working/Source/Release"); fixture.FileSystem.CreateFile("/Working/Source/Release/Sourcefile1.txt"); fixture.FileSystem.CreateDirectory("/Working/Source/Sourcedirectory2"); fixture.FileSystem.CreateFile("/Working/Source/Sourcedirectory2/Sourcefile2.txt"); fixture.FileSystem.CreateDirectory("/Working/Source/Sourcedirectory2/Subsourcedirectory"); fixture.FileSystem.CreateFile("/Working/Source/Sourcedirectory2/Subsourcedirectory/Subsourcefile.txt"); EndpointCreatorSettings settings = new EndpointCreatorSettings { BuildConfiguration = "Release" }; var result = Record.Exception(() => fixture.Run(settings)); Assert.Null(result); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpoint/Target/Subtarget1/Sourcefile1.txt").Exists); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpoint/Target/Subtarget2/Sourcefile2.txt").Exists); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpoint/Target/Subtarget2/Subsourcedirectory/Subsourcefile.txt").Exists); }
public void Create_TargetRootPathDefined_PathGetsExtended() { var fixture = new EndpointCreatorFixture(new[] { new Model.Endpoint { Id = "SomeEndpoint", Files = new[] { new File { SourcePath = "/Working/Source/Sourcefile1.txt", TargetPath = "Target/Subtarget1/" }, new File { SourcePath = "/Working/Source/Sourcefile2.txt", TargetPath = "Target/Subtarget2/" } } } }); fixture.FileSystem.CreateDirectory("/Working/Source"); fixture.FileSystem.CreateFile("/Working/Source/Sourcefile1.txt"); fixture.FileSystem.CreateFile("/Working/Source/Sourcefile2.txt"); EndpointCreatorSettings settings = new EndpointCreatorSettings { ZipTargetPath = true }; var result = Record.Exception(() => fixture.Run(settings)); Assert.Null(result); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpoint/Target/Subtarget1/sourcefile1.txt").Exists); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpoint/Target/Subtarget2/sourcefile2.txt").Exists); Assert.True(fixture.FileSystem.GetFile("/Working/SomeEndpoint.zip").Exists); }
public static void EndpointCreate(this ICakeContext context, IEnumerable <Model.Endpoint> endpoints, EndpointCreatorSettings settings) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (endpoints == null) { throw new ArgumentNullException(nameof(endpoints)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } new EndpointCreator(context, context.FileSystem, context.Environment, context.Log).Create(endpoints, settings); }
public void Run(EndpointCreatorSettings settings) { Context.EndpointCreate(Endpoints, settings); }