Пример #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));
            }
        }
Пример #2
0
        public void CanConstruct()
        {
            var instance = new StandardClassGenerationStrategy(_frameworkSet);

            Assert.That(instance, Is.Not.Null);
        }
Пример #3
0
 public void SetUp()
 {
     _frameworkSet = Substitute.For <IFrameworkSet>();
     _testClass    = new StandardClassGenerationStrategy(_frameworkSet);
 }