public void AllocateMemoryBuffer_WhenManagerNotInitialised_Ignored_OK() { using (var manager = new MemoryManager()) { // not initialised // arrange uint bufferId; // act & assert Assert.That(() => manager.AllocateMemoryBuffer(100, out bufferId), Throws.Nothing); } }
/// <summary> /// This is the initial console harness - it may become the full thing /// </summary> /// <param name="args"></param> /// <returns></returns> static int Main(string[] args) { var returnCode = 0; var returnCodeOffset = 0; var logger = LogManager.GetLogger(typeof (Bootstrapper)); try { CommandLineParser parser; if (!ParseCommandLine(args, out parser)) return parser.ReturnCodeOffset + 1; LogManager.GetRepository().Threshold = parser.LogLevel; returnCodeOffset = parser.ReturnCodeOffset; var filter = BuildFilter(parser); string outputFile; if (!GetFullOutputFile(parser, out outputFile)) return returnCodeOffset + 1; using (var memoryManager = new MemoryManager()) { var container = new Bootstrapper(logger); var persistance = new FilePersistance(parser, logger); container.Initialise(filter, parser, persistance, memoryManager); persistance.Initialise(outputFile); var registered = false; try { if (parser.Register) { ProfilerRegistration.Register(parser.UserRegistration); registered = true; } var harness = (IProfilerManager) container.Container.Resolve(typeof (IProfilerManager), null); harness.RunProcess((environment) => { returnCode = 0; if (parser.Service) { RunService(parser, environment, logger); } else { returnCode = RunProcess(parser, environment); } }, parser.Service); DisplayResults(persistance, parser, logger); } catch (Exception ex) { Trace.WriteLine(string.Format("Exception: {0}\n{1}", ex.Message, ex.InnerException)); throw; } finally { if (parser.Register && registered) ProfilerRegistration.Unregister(parser.UserRegistration); } } } catch (Exception ex) { if (logger.IsFatalEnabled) { logger.FatalFormat("An exception occured: {0}", ex.Message); logger.FatalFormat("stack: {0}", ex.StackTrace); } returnCode = returnCodeOffset + 1; } return returnCode; }
public void SetUp() { _manager = new MemoryManager(); _manager.Initialise("Local", "C#", new String[0]); }