示例#1
0
        public void ShouldBeAbleToCreateJobModelTypes()
        {
            var created = from simpleCommand in Command.NewSimpleCommand("echo 'Hello, World!'").Lift("simple-command")
                          from parameterizedCommand in
                          Command.NewParametrizedCommand(
                new ParametrizedCommand(
                    "echo 'Hello, %user%'",
                    new[]
            {
                "user"
            }.ToFSharpList())).Lift()
                          from tryWithCatch in
                          new CommandWithErrorHandler(parameterizedCommand, FSharpOption <Command> .Some(simpleCommand)).Lift(
                "try-with-catch")
                          from tryWithoutCatch in
                          new CommandWithErrorHandler(simpleCommand, FSharpOption <Command> .None).Lift("try-without-catch")
                          from commandSet0 in CommandSet.Zero.Lift()
                          from commandSet in new CommandSet(
                new[]
            {
                tryWithCatch
            }.ToFSharpList(),
                new[]
            {
                simpleCommand
            }.ToFSharpList()).Lift()
                          from localFiles0 in LocalFiles.Zero.Lift()
                          from localFiles in LocalFiles.NewLocalFiles(
                new[]
            {
                new FileInfo("temp.txt")
            }.ToFSharpList()).Lift()
                          from uploadedFiles0 in UploadedFiles.Zero.Lift()
                          from uploadedFiles in UploadedFiles.NewUploadedFiles(
                new[]
            {
                new ResourceFile("blobSource", "blobPath")
            }.ToFSharpList()).Lift("uploaded-files")
                          from workloadUnitTemplate0 in WorkloadUnitTemplate.Zero.Lift()
                          from workloadUnitTemplate in new WorkloadUnitTemplate(commandSet, localFiles, false).Lift()
                          from workloadArguments0 in WorkloadArguments.Zero.Lift()
                          from workloadArguments in
                          WorkloadArguments.NewWorkloadArguments(
                new Dictionary <string, FSharpList <string> >
            {
                {
                    "users", new[]
                    {
                        "john",
                        "pradeep"
                    }.ToFSharpList()
                }
            }.ToFSharpMap()).Lift()
                          from workloadSpecification in new WorkloadSpecification(
                new[]
            {
                workloadUnitTemplate
            }.ToFSharpList(),
                LocalFiles.Zero,
                workloadArguments).Lift()
                          from taskName in TaskName.NewTaskName("simple-task").Lift()
                          from taskArguments0 in TaskArguments.Zero.Lift()
                          from taskArguments in TaskArguments.NewTaskArguments(
                new Dictionary <string, string>
            {
                { "name", "john" }
            }.ToFSharpMap()).Lift()
                          from defaultTaskSpecification in TaskSpecification.Zero.Lift()
                          from jobName in JobName.NewJobName("simple-job").Lift()
                          from nullJobPriority in JobPriority.NewJobPriority(null).Lift()
                          from jobPriority in JobPriority.NewJobPriority(10).Lift()
                          from defaultJobSpecification in JobSpecification.Zero.Lift()
                          select "done";

            Assert.AreEqual("done", created.Value);
        }