コード例 #1
0
ファイル: TypeAdapter.cs プロジェクト: juherr/fit
 //
 //
 //    // Factory //////////////////////////////////
 //
 public static TypeAdapter on(Fixture target, Type type)
 {
     TypeAdapter adapter = new TypeAdapter();
     adapter.fixture = target;
     adapter.target = target;
     adapter.type = type;
     return adapter;
 }
コード例 #2
0
		public override void Set(Fixture fixture, object value) {
			if (ParameterDirection.Input.Equals(dbp.Direction)
				||
				ParameterDirection.InputOutput.Equals(dbp.Direction))
				dbp.Value = value==null?DBNull.Value:value;
			else
				throw new NotSupportedException("Cannot use output parameters as input values. Did you forget a question mark after " + dbp.ParameterName);

		}
コード例 #3
0
			public override bool HandleEvaluate(Fixture fixture, Parse cell, Accessor accessor)
			{
            	object actual=GetActual(accessor, fixture);
				if (actual==null) return false;
                String cellText=cell.Text;
                String expected = cellText.Substring(1, cellText.Length - 2);
//                Console.WriteLine(
//                    ("[" + cellText + "][" + expected + "][" + actual + "]").Replace(" ","x")                    
//                    );
                return expected.Equals(actual);
			}
コード例 #4
0
		public override object Get(Fixture fixture) {
			if (ParameterDirection.Input.Equals(dbp.Direction))
				throw new NotSupportedException("Cannot use input parameters as output values. Please remove the question mark after " + dbp.ParameterName);
			if (typeof(DataTable).Equals(dotNetType) && (dbp.Value is DbDataReader)) {
					DataTable dt=new DataTable();
					dt.Load((DbDataReader) dbp.Value);
					return dt;
			}
			//Console.Write("Reading value of "+dbp.DbType+" " +dbp.ParameterName + " = " + dbp.Value+"\n");
			return dbp.Value;
		}
コード例 #5
0
			public override bool HandleEvaluate(Fixture fixture, Parse cell, Accessor accessor)
			{
				object actual=GetActual(accessor, fixture);
				if (actual== null) return false;

				byte[] actbyte = (byte[]) actual;
				byte[] expected=ParseArray(cell.Text);
				if (actbyte.Length!=expected.Length) return false;
				for (int i=0; i<actbyte.Length; i++)
					if (actbyte[i]!=expected[i]) return false;
				return true;
			}
コード例 #6
0
        public String Output()
        {
            Parse parse = new Parse(OriginalHTML, new String[] {"td"});
            Fixture testbed = new Fixture();

            if (Annotation.Equals("right")) testbed.right(parse);
            if (Annotation.Equals("wrong")) testbed.wrong(parse, Text);
            if (Annotation.Equals("error")) testbed.error(parse, Text);
            if (Annotation.Equals("info")) testbed.info(parse, Text);
            if (Annotation.Equals("ignore")) testbed.ignore(parse);

            return GenerateOutput(parse);
        }
コード例 #7
0
 public override void HandleCheck(Fixture fixture, Parse cell, Accessor accessor)
 {
     string expected = cell.Text.Substring("fail[".Length, cell.Text.Length - ("fail[".Length + 1));
     Parse newCell = new Parse("td", expected, null, null);
     ICellHandler handler = CellOperation.GetHandler(fixture, newCell, accessor.ParameterType);
     if (handler.HandleEvaluate(fixture, newCell, accessor))
     {
         fixture.Wrong(cell);
     }
     else
     {
         fixture.Right(cell);
     }
 }
コード例 #8
0
ファイル: FrameworkTest.cs プロジェクト: juherr/fit
        protected void run(string file, int right, int wrong, int ignores, int exceptions)
        {
            string root = findRoot(file);
            string input = readExample(root + file);
            Fixture fixture = new Fixture();
            Fixture.assemblyDirs = new string[] {".", @"..\..\..\eg\bin\Debug"};
            Parse tables;
            if (input.IndexOf("<wiki>") >= 0)
            {
                tables = new Parse(input, new String[]{"wiki", "table", "tr", "td"});
                fixture.doTables(tables.parts);
            }
            else
            {
                tables = new Parse(input, new String[]{"table", "tr", "td"});
                fixture.doTables(tables);
            }
            StringWriter output = new StringWriter();
            tables.print(output);
            output.Close();

            Assert.AreEqual(right, fixture.counts.right, file+" right");
            Assert.AreEqual(wrong, fixture.counts.wrong, file+" wrong");
            Assert.AreEqual(ignores, fixture.counts.ignores, file+" ignores");
            Assert.AreEqual(exceptions, fixture.counts.exceptions, file+" exceptions");
        }
コード例 #9
0
ファイル: ActionFixture.cs プロジェクト: juherr/fit
 // Actions //////////////////////////////////
 public virtual void start()
 {
     actor = loadFixture(cells.more.text());
 }
コード例 #10
0
			public override void HandleInput(Fixture fixture, Parse cell, Accessor accessor)
			{
                String cellText=cell.Text;
                String actual= cellText.Substring(1, cellText.Length - 2);
				accessor.Set(fixture,actual);
			}
コード例 #11
0
ファイル: TypeAdapter.cs プロジェクト: juherr/fit
 public static TypeAdapter on(Fixture target, MethodInfo method)
 {
     TypeAdapter adapter = on(target, method.ReturnType);
     adapter.method = method;
     return adapter;
 }
コード例 #12
0
ファイル: Fixture.cs プロジェクト: russelyang/fitsharp
 public void Prepare(Interpreter parent, Tree<Cell> table)
 {
     var parentFixture = (Fixture) parent;
     Processor = parentFixture.Processor;
     myParentFixture = parentFixture;
     GetArgsForRow(table.Branches[0]);
 }
コード例 #13
0
ファイル: TypeAdapter.cs プロジェクト: juherr/fit
 public static TypeAdapter on(Fixture target, FieldInfo field)
 {
     TypeAdapter adapter = on(target, field.FieldType);
     adapter.field = field;
     return adapter;
 }
コード例 #14
0
			public override void HandleInput(Fixture fixture, Parse cell, Accessor accessor)
			{
				accessor.Set(fixture,ParseArray(cell.Text));
			}
コード例 #15
0
ファイル: Dialog.cs プロジェクト: juherr/fit
 protected internal Dialog(string message, Fixture caller)
 {
     this.messageVar = message;
     this.caller = caller;
 }
コード例 #16
0
		public override void Set(Fixture fixture, object value) {
			throw new NotSupportedException("data columns are read only");
		}
コード例 #17
0
		public override object Get(Fixture fixture) {
			DataRow dr = (DataRow)fixture.GetTargetObject();
			return GetValue(dr, column);
		}