Exemple #1
0
        public void IsNotScenarioTest2(string path)
        {
            var fullName = Path.GetFullPath(Path.Combine(TestDirPath, path));

            Assert.True(File.Exists(fullName) || Directory.Exists(fullName));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName));
        }
Exemple #2
0
        public void IsScenarioTest(string path, ScenarioParameterType scenarioParameterType, ContainerParameterType containerParameterType)
        {
            var fullName = Path.GetFullPath(Path.Combine(TestDirPath, "正常系/", path));

            Assert.True(CardWirthScenario.IsScenarioSummary(fullName, scenarioParameterType, containerParameterType));
            Assert.True(CardWirthScenario.IsScenarioSummary(fullName));
            Assert.True(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Any, ContainerParameterType.Any));
        }
Exemple #3
0
        public void IsWsnScenarioTest(string path)
        {
            var fullName = Path.GetFullPath(Path.Combine(TestDirPath, "正常系/", path));

            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Classic, ContainerParameterType.Any));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Next, ContainerParameterType.Any));
            Assert.True(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Wsn, ContainerParameterType.Any));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Classic));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Next));
            Assert.True(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Wsn));
        }
Exemple #4
0
        public void IsDirectoryScenarioTest(string path)
        {
            var fullName = Path.GetFullPath(Path.Combine(TestDirPath, "正常系/", path));

            Assert.True(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Any, ContainerParameterType.Directory));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Any, ContainerParameterType.ZipFile));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Any, ContainerParameterType.CabFile));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ScenarioParameterType.Any, ContainerParameterType.WsnFile));
            Assert.True(CardWirthScenario.IsScenarioSummary(fullName, ContainerParameterType.Directory));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ContainerParameterType.CabFile));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ContainerParameterType.ZipFile));
            Assert.False(CardWirthScenario.IsScenarioSummary(fullName, ContainerParameterType.WsnFile));
        }
        protected override void ProcessRecord()
        {
            WriteVerbose("Path:" + String.Join(",", Path));
            WriteVerbose("LiteralPath:" + String.Join(",", LiteralPath));
            WriteVerbose("_paths:" + String.Join(",", _paths));
            WriteVerbose("_suppressWildcardExpansion:" + _suppressWildcardExpansion.ToString());
            WriteVerbose("ScenarioType:" + ScenarioType.ToString());
            WriteVerbose("ContaierType:" + ContainerType.ToString());

            foreach (string path in _paths)
            {
                WriteVerbose("path:" + path);

                if (!InvokeProvider.Item.Exists(path, true, _suppressWildcardExpansion))
                {
                    WriteObject(false);
                    continue;
                }

                var items = Enumerable.Empty <PSObject>();

                try
                {
                    items = InvokeProvider.Item.Get(new string[] { path }, true, _suppressWildcardExpansion) ?? Enumerable.Empty <PSObject>();
                }
                catch (PSNotSupportedException notSupported)
                {
                    WriteError(new ErrorRecord(notSupported.ErrorRecord, notSupported));
                    continue;
                }
                catch (DriveNotFoundException driveNotFound)
                {
                    WriteError(new ErrorRecord(driveNotFound.ErrorRecord, driveNotFound));
                    continue;
                }
                catch (ProviderNotFoundException providerNotFound)
                {
                    WriteError(new ErrorRecord(providerNotFound.ErrorRecord, providerNotFound));
                    continue;
                }
                catch (ItemNotFoundException pathNotFound)
                {
                    WriteError(new ErrorRecord(pathNotFound.ErrorRecord, pathNotFound));
                    continue;
                }

                foreach (var item in items)
                {
                    WriteVerbose("item:" + item.ToString());

                    if (item.BaseObject is System.IO.FileSystemInfo info)
                    {
                        try
                        {
                            // フルパスからシナリオかどうか判定する
                            WriteVerbose("fullName:" + info.FullName);
                            WriteObject(CardWirthScenario.IsScenarioSummary(info.FullName, ScenarioType, ContainerType));
                        }
                        catch (Exception)
                        {
                            WriteObject(false);
                        }
                    }
                }
            }
        }