示例#1
0
        public void WhenIGenerateTestsForTheClass(string strategy)
        {
            var options      = new UnitTestGeneratorOptions(new GenerationOptions(_context.TargetFramework, _context.MockFramework), new VersionOptions());
            var frameworkSet = FrameworkSetFactory.Create(options);

            IClassGenerationStrategy generationStrategy = null;

            if (strategy == "StandardClassGenerationStrategy")
            {
                generationStrategy = new StandardClassGenerationStrategy(frameworkSet);
            }

            if (strategy == "StaticClassGenerationStrategy")
            {
                generationStrategy = new StaticClassGenerationStrategy(frameworkSet);
            }

            if (strategy == "AbstractClassGenerationStrategy")
            {
                generationStrategy = new AbstractClassGenerationStrategy(frameworkSet);
            }

            if (generationStrategy == null)
            {
                throw new InvalidOperationException();
            }

            _context.Result       = generationStrategy.Create(_context.ClassModel);
            _context.CurrentClass = _context.Result;

            using (var workspace = new AdhocWorkspace())
            {
                Console.WriteLine(Formatter.Format(_context.Result, workspace));
            }
        }
        public void CanConstruct()
        {
            var instance = new StaticClassGenerationStrategy(_frameworkSet);

            Assert.That(instance, Is.Not.Null);
        }
 public void SetUp()
 {
     _frameworkSet = Substitute.For <IFrameworkSet>();
     _testClass    = new StaticClassGenerationStrategy(_frameworkSet);
 }