Exemple #1
0
        public IXUnitSetupGenerator GetInstance(IClassUnderTestFinder classUnderTestFinder)
        {
            var classUnderTestNameFinder       = new ClassUnderTestNameFinder();
            var constructorParametersExtractor = new ConstructorParametersExtractor();
            var fieldFinder                  = new FieldFinder();
            var memberFinder                 = new MemberFinder();
            var constructorGenerator         = new ConstructorGenerator();
            var expressionStatementGenerator = new ExpressionStatementGenerator();
            var fieldNameGenerator           = new FieldNameGenerator();
            var fieldDeclarationGenerator    = new FieldDeclarationGenerator(fieldNameGenerator);
            var methodGenerator              = new MethodGenerator();
            var usingDirectivesGenerator     = new UsingDirectivesGenerator();

            var setupMethodBodyBuilder = new SetupMethodBodyBuilder(constructorParametersExtractor, expressionStatementGenerator, fieldNameGenerator);

            return(new XUnitSetupGenerator(classUnderTestNameFinder, classUnderTestFinder, constructorParametersExtractor, fieldDeclarationGenerator, setupMethodBodyBuilder, constructorGenerator, usingDirectivesGenerator, memberFinder, fieldFinder));
        }
 public FieldNameGeneratorTests()
 {
     _target = new FieldNameGenerator();
 }
Exemple #3
0
 public void SetView(View view)
 {
     PageNameGenerator  = new PageNameGenerator(view);
     FieldNameGenerator = new FieldNameGenerator(view);
 }
        public void ShouldReturnEmptyStringForNullOrEmptyName(string name, string expectedResult)
        {
            string result = FieldNameGenerator.Generate(name);

            Assert.AreEqual(expectedResult, result);
        }
        public void ShouldCreateValidFieldNameFromName(string name, string expectedResult)
        {
            string result = FieldNameGenerator.Generate(name);

            Assert.AreEqual(expectedResult, result);
        }
        public void ShouldCreateValidFieldNameWithPrefixFromNameAndPrefix(string name, char prefix, string expectedResult)
        {
            string result = FieldNameGenerator.Generate(name, prefix);

            Assert.AreEqual(expectedResult, result);
        }