Пример #1
0
		public override void SetUp()
		{
			base.SetUp();
			project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage);
			codeGenerator = MockRepository.GenerateStrictMock<CodeGenerator>();
			codeModelContext = new CodeModelContext {
				CodeGenerator = codeGenerator,
				CurrentProject = project
			};
		}
Пример #2
0
        public override void SetUp()
        {
            base.SetUp();
            project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage);

            codeGenerator = MockRepository.GenerateMock<CodeGenerator>();
            languageBinding = MockRepository.GenerateMock<ILanguageBinding>();
            languageBinding.Stub(binding => binding.CodeGenerator).Return(codeGenerator);
            project.Stub(p => p.LanguageBinding).Return(languageBinding);

            codeModelContext = new CodeModelContext {
                CurrentProject = project
            };
        }
		string GenerateFormatString(ITypeDefinition currentClass, CodeGenerator generator, string[] fields)
		{
			string fieldsString = "";
			
			if (fields.Any()) {
				StringBuilder formatString = new StringBuilder();
				
				for (int i = 0; i < fields.Length; i++) {
					if (i != 0)
						formatString.Append(", ");
					formatString.AppendFormat("{0}={{{1}}}", generator.GetPropertyName(fields[i]), i);
				}
				
				fieldsString = " " + formatString.ToString();
			}
			
			return "[" + currentClass.Name + fieldsString + "]";
		}
 public ThreadSafeCodeGenerator(CodeGenerator codeGenerator)
 {
     this.codeGenerator = codeGenerator;
     this.mainThread = SD.MainThread;
 }