Ejemplo n.º 1
0
        protected internal override TestDirectory CreateField(ExtensionContext extensionContext)
        {
            ExtensionContext.Store fileSystemStore       = GetStore(extensionContext, FileSystemExtension.FileSystemNamespace);
            FileSystemAbstraction  fileSystemAbstraction = fileSystemStore.get(FileSystemExtension.FILE_SYSTEM, typeof(FileSystemAbstraction));

            return(fileSystemAbstraction != null?testDirectory(fileSystemAbstraction) : testDirectory());
        }
Ejemplo n.º 2
0
        public override void AfterEach(ExtensionContext context)
        {
            Profiler profiler = GetStoredValue(context);

            try
            {
                profiler.Finish();
                if (context.ExecutionException.Present)
                {
                    ExtensionContext.Store testDirStore = GetStore(context, TestDirectoryExtension.TestDirectoryNamespace);
                    TestDirectory          testDir      = ( TestDirectory )testDirStore.get(TestDirectoryExtension.TEST_DIRECTORY);
                    File profileOutputFile   = testDir.CreateFile("profiler-output.txt");
                    FileSystemAbstraction fs = testDir.FileSystem;

                    using (PrintStream @out = new PrintStream(fs.OpenAsOutputStream(profileOutputFile, false)))
                    {
                        string displayName = context.TestClass.map(Type.getSimpleName).orElse("class") + "." + context.DisplayName;
                        profiler.PrintProfile(@out, displayName);
                    }
                }
            }
            catch (Exception e)
            {
                throw new JUnitException("Failed to finish profiling and/or produce profiling output.", e);
            }
        }
Ejemplo n.º 3
0
 private object CreateInstance(ExtensionContext extensionContext)
 {
     ExtensionContext.Store store = GetLocalStore(extensionContext);
     return(store.getOrComputeIfAbsent(FieldKey, (System.Func <string, object>)s => CreateField(extensionContext)));
 }