Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 public void TestCatchOfException()
 {
     var modelData = new Hashtable();
     modelData.Add("Existing", "Hi");
     modelData.Add("Model", new Hashtable());
     var tag = new Catch();
     tag.Var = new MockAttribute(new Constant("error"));
     tag.Body = new MockAttribute(new Property("Broken.Point"));
     var model = new TagModel(new Broken());
     Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
     Assert.That(((ReflectionException) model["Model.error"]).Message,
                 Text.StartsWith(ReflectionException.PropertyNotFound("Broken", typeof(Broken)).Message));
 }
Ejemplo n.º 2
0
 public void TestCatchOfExceptionDifferentPageScope()
 {
     var modelData = new Hashtable();
     modelData.Add("PageScope", VariableScope.Page.ToString());
     modelData.Add("Broken", new Broken());
     modelData.Add("Page", new Hashtable());
     var tag = new Catch();
     tag.Var = new MockAttribute(new Constant("error"));
     tag.Body = new MockAttribute(new Property("Broken.Banana"));
     tag.Scope = new MockAttribute(new Property("PageScope"));
     var model = new TagModel(modelData);
     Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
     Assert.That(model["Model.error"], Is.Null);
     Assert.That(((ReflectionException) model["Page.error"]).Message,
                  Text.StartsWith(ReflectionException.PropertyNotFound("Banana", typeof(Broken)).Message));
 }
        protected internal override void TraverseCatch(Catch @catch)
        {
            if (@catch.Filter != null)
            {
                _writer.WriteLine("filter");
                Traverse(@catch.Filter);
            }

            String s_exn = null as String;
            if (@catch.ExceptionType == null) s_exn = null;
            else if (@catch.ExceptionType == typeof(Object)) s_exn = null;
            else s_exn = String.Format("({0})", @catch.ExceptionType.GetCSharpRef(ToCSharpOptions.Informative));

            var head = @catch.ExceptionType != null ? "catch" : "fault";
            if (s_exn.IsNeitherNullNorEmpty()) head += ("" + s_exn);
            _writer.WriteLine(head);
            base.TraverseBlock(@catch);
        }
 protected override void Because()
 {
     thrown = Catch.Exception(() => ((ICommitEvents)Store).Commit(corrupt));
 }
Ejemplo n.º 5
0
 public virtual Statement MarkAsInstrumentationCode(Block block){
   Throw rethrow = new Throw();
   rethrow.NodeType = NodeType.Rethrow;
   Catch catchClause = new Catch(new Block(new StatementList(rethrow)), new Local(SystemTypes.ContractMarkerException), SystemTypes.ContractMarkerException);
   CatchList catchers = new CatchList(1);
   catchers.Add(catchClause);
   return new Try(block, catchers, null, null, null);
 }
Ejemplo n.º 6
0
 /**
  * Call back method that must be called when the given <code>
  * Catch</code> will become the next <i>traverse candidate</i>.
  *
  * @param pCatchClause  The <code>Catch</code> object that will
  *                      become the next <i>traverse candidate</i>.
  */
 public void performAction(
      Catch pCatchClause)
 {
     // Nothing to do.
 }
Ejemplo n.º 7
0
    public virtual Differences VisitCatch(Catch catch1, Catch catch2){
      Differences differences = new Differences(catch1, catch2);
      if (catch1 == null || catch2 == null){
        if (catch1 != catch2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Catch changes = (Catch)catch2.Clone();
      Catch deletions = (Catch)catch2.Clone();
      Catch insertions = (Catch)catch2.Clone();

      Differences diff = this.VisitBlock(catch1.Block, catch2.Block);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Block = diff.Changes as Block;
      deletions.Block = diff.Deletions as Block;
      insertions.Block = diff.Insertions as Block;
      Debug.Assert(diff.Changes == changes.Block && diff.Deletions == deletions.Block && diff.Insertions == insertions.Block);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitTypeNode(catch1.Type, catch2.Type);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Type = diff.Changes as TypeNode;
      deletions.Type = diff.Deletions as TypeNode;
      insertions.Type = diff.Insertions as TypeNode;
      //Debug.Assert(diff.Changes == changes.Type && diff.Deletions == deletions.Type && diff.Insertions == insertions.Type);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitExpression(catch1.Variable, catch2.Variable);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Variable = diff.Changes as Expression;
      deletions.Variable = diff.Deletions as Expression;
      insertions.Variable = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Variable && diff.Deletions == deletions.Variable && diff.Insertions == insertions.Variable);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      if (differences.NumberOfDifferences == 0){
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
Ejemplo n.º 8
0
        private void ReadExceptionHandlers(BinaryReader reader, MethodDefinition mdef, InstructionReader instructionReader, ushort triesSize)
        {
            var exceptionLookup = new Dictionary<uint, List<ExceptionHandler>>();
            for (var i = 0; i < triesSize; i++)
            {
                var startOffset = reader.ReadUInt32();
                var insCount = reader.ReadUInt16();
                var endOffset = startOffset + insCount - 1;
                uint handlerOffset = reader.ReadUInt16();

                var ehandler = new ExceptionHandler();
                mdef.Body.Exceptions.Add(ehandler);
                if (!exceptionLookup.ContainsKey(handlerOffset))
                {
                    exceptionLookup.Add(handlerOffset, new List<ExceptionHandler>());
                }
                exceptionLookup[handlerOffset].Add(ehandler);
                ehandler.TryStart = instructionReader.Lookup[(int)startOffset];
                // The last code unit covered (inclusive) is start_addr + insn_count - 1
                ehandler.TryEnd = instructionReader.LookupLast[(int)endOffset];
            }

            var baseOffset = reader.BaseStream.Position;
            var catchHandlersSize = reader.ReadULEB128();
            for (var i = 0; i < catchHandlersSize; i++)
            {
                var itemoffset = reader.BaseStream.Position - baseOffset;
                var catchTypes = reader.ReadSLEB128();
                var catchAllPresent = catchTypes <= 0;
                catchTypes = Math.Abs(catchTypes);

                for (var j = 0; j < catchTypes; j++)
                {
                    var typeIndex = reader.ReadULEB128();
                    var offset = reader.ReadULEB128();
                    var @catch = new Catch
                    {
                        Type = Dex.TypeReferences[(int) typeIndex],
                        Instruction = instructionReader.Lookup[(int) offset]
                    };

                    // As catch handler can be used in several tries, let's clone the catch
                    foreach (var ehandler in exceptionLookup[(uint)itemoffset])
                        ehandler.Catches.Add(@catch.Clone());
                }

                if (!catchAllPresent)
                    continue;

                var caOffset = reader.ReadULEB128();
                foreach (var ehandler in exceptionLookup[(uint)itemoffset])
                    ehandler.CatchAll = instructionReader.Lookup[(int)caOffset];
            }
        }
Ejemplo n.º 9
0
void case_996()
#line 6648 "cs-parser.jay"
{
		start_block (GetLocation (yyVals[-3+yyTop]));
		var c = new Catch ((ExplicitBlock) current_block, GetLocation (yyVals[-4+yyTop]));
		c.TypeExpression = (FullNamedExpression) yyVals[-2+yyTop];

		if (yyVals[-1+yyTop] != null) {
			var lt = (LocatedToken) yyVals[-1+yyTop];
			c.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
			current_block.AddLocalName (c.Variable);
		}

		lbag.AddLocation (c, GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
		yyVal = c;
		lexer.parsing_catch_when = true;
	  }
 public void should_throw_an_exception_when_clearing_the_uncommitted_collection()
 {
     Catch.Exception(() => Stream.UncommittedEvents.Clear()).Should().BeOfType <NotSupportedException>();
 }
Ejemplo n.º 11
0
 private static string CatchToString(Catch c) 
 {
   StringBuilder sb = new StringBuilder();
   if(c.Variable == null)
     sb.Append("top_of_stack");
   else
     sb.Append(CodePrinter.expression2str(c.Variable));
   sb.Append(" = catch(");
   if (c.Type != null)
     sb.Append(c.Type.FullName);
   sb.Append(")");
   return sb.ToString();
 }
 protected override void Because()
 {
     _thrown = Catch.Exception(() => Stream.CommitChanges(Guid.NewGuid()));
 }
 public void should_throw_an_exception_when_adding_to_the_committed_collection()
 {
     Catch.Exception(() => Stream.CommittedEvents.Add(null)).Should().BeOfType <NotSupportedException>();
 }
 protected override void Because()
 {
     _thrown = Catch.Exception(() => Stream.CommitChanges(_dupliateCommitId));
 }
Ejemplo n.º 15
0
 public CatchPage(Catch pickedCatch)
 {
     _pickedCatch = pickedCatch;
     InitializeComponent();
 }
Ejemplo n.º 16
0
 public override void SetUp()
 {
     base.SetUp();
     _exception = Catch.Exception(() => Fraction.FromDouble(double.NegativeInfinity));
 }
Ejemplo n.º 17
0
 public void CheckRequired()
 {
     var tag = new Catch();
     RequiredAttribute.Check(tag);
 }
 public void should_throw_an_exception_when_removing_from_the_uncommitted_collection()
 {
     Catch.Exception(() => Stream.UncommittedEvents.Remove(null)).Should().BeOfType <NotSupportedException>();
 }
Ejemplo n.º 19
0
 public override void SetUp()
 {
     base.SetUp();
     _exception = Catch.Exception(() => Fraction.FromDouble(double.NaN));
 }
Ejemplo n.º 20
0
 public async Task When_Posting_A_Message_And_There_Is_No_Outbox_Async()
 {
     _exception = await Catch.ExceptionAsync(async() => await _commandProcessor.PostAsync(_myCommand));
 }
Ejemplo n.º 21
0
 public virtual void VisitCatch(Catch Catch)
 {
   if (Catch == null) return;
   this.VisitTargetExpression(Catch.Variable);
   this.VisitTypeReference(Catch.Type);
   this.VisitBlock(Catch.Block);
 }
Ejemplo n.º 22
0
        public void When_reading_messages_by_numerical_range()
        {
            var exception = Catch.Exception(() => _dynamoDbMessageStore.Get(3, 1));

            exception.Should().BeOfType <NotSupportedException>();
        }
Ejemplo n.º 23
0
 public override Statement VisitCatch(Catch Catch) {
   if (Catch == null) return null;
   bool savedInsideCatchClause = this.insideCatchClause;
   this.insideCatchClause = true;
   Catch.Variable = this.VisitTargetExpression(Catch.Variable);
   TypeNode t = Catch.Type = this.VisitTypeReference(Catch.Type);
   if (t != null)
     t = Catch.Type = TypeNode.StripModifiers(t);
   if (t != null && !this.GetTypeView(t).IsAssignableTo(SystemTypes.Exception))
     this.HandleError(Catch.TypeExpression, Error.BadExceptionType);
   Catch savedCatchClause = this.currentCatchClause;
   this.currentCatchClause = Catch;
   Catch.Block = this.VisitBlock(Catch.Block);
   this.currentCatchClause = savedCatchClause;
   this.insideCatchClause = savedInsideCatchClause;
   return Catch;
 }
Ejemplo n.º 24
0
 public void start(SCApplication _app)
 {
     OperateDB    = new DB(_app.PortStationDao);
     OperateCatch = new Catch(_app.getEQObjCacheManager());
     web          = new Web(_app.webClientManager);
 }
Ejemplo n.º 25
0
 protected internal virtual void TraverseCatch(Catch @catch) { Traverse(@catch.Filter); TraverseClause(@catch); }
Ejemplo n.º 26
0
            public void GetReadsSnapshotOfUnknownId()
            {
                Catch.ExceptionOf(() => _sut.Get(_model.UnknownIdentifier));

                A.CallTo(() => _reader.ReadOptional(_model.UnknownIdentifier)).MustHaveHappened();
            }
 public override Statement VisitCatch(Catch c) 
 {
   c.Variable = get_stack_var(0, SystemTypes.Object);
   return c;
 }
Ejemplo n.º 28
0
            public void GetResolvesNameOfUnknownId()
            {
                Catch.ExceptionOf(() => _sut.Get(_model.UnknownIdentifier));

                A.CallTo(() => _resolver.Resolve(_model.UnknownIdentifier)).MustHaveHappened();
            }
			CatchClause ConvertCatch (Catch ctch)
			{
				CatchClause result = new CatchClause ();
				var location = LocationsBag.GetLocations (ctch);
				result.AddChild (new CSharpTokenNode (Convert (ctch.loc), CatchClause.CatchKeywordRole), CatchClause.CatchKeywordRole);
				if (ctch.TypeExpression != null) {
					if (location != null)
						result.AddChild (new CSharpTokenNode (Convert (location [0]), Roles.LPar), Roles.LPar);
					
					if (ctch.TypeExpression != null)
						result.AddChild (ConvertToType (ctch.TypeExpression), Roles.Type);
					if (ctch.Variable != null && !string.IsNullOrEmpty (ctch.Variable.Name))
						result.AddChild (Identifier.Create (ctch.Variable.Name, Convert (ctch.Variable.Location)), Roles.Identifier);
					
					if (location != null && location.Count > 1)
						result.AddChild (new CSharpTokenNode (Convert (location [1]), Roles.RPar), Roles.RPar);
				}

				if (ctch.Block != null)
					result.AddChild ((BlockStatement)ctch.Block.Accept (this), Roles.Body);
				
				return result;
			}
Ejemplo n.º 30
0
 public override void Act()
 {
     _exception = Catch.Exception(() => _a.Remainder(_b));
 }
 protected internal override void TraverseCatch(Catch @catch)
 {
     Traverse(@catch.Filter);
     @catch.ForEach(Traverse);
     Types.Add(@catch, null);
 }
Ejemplo n.º 32
0
 protected override void Because()
 {
     thrown = Catch.Exception(() => ((ICommitEvents)Store).Commit(invalidCommitSequence));
 }
 protected internal override Node TransformCatch(Catch @catch)
 {
     return Dispatch(@catch);
 }
Ejemplo n.º 34
0
 public virtual Statement VisitCatch(Catch Catch1, Catch Catch2)
 {
     if (Catch1 == null) return null;
     if (Catch2 == null)
     {
         Catch1.Variable = this.VisitTargetExpression(Catch1.Variable, null);
         Catch1.Type = this.VisitTypeReference(Catch1.Type, null);
         Catch1.Block = this.VisitBlock(Catch1.Block, null);
     }
     else
     {
         Catch1.Variable = this.VisitTargetExpression(Catch1.Variable, Catch2.Variable);
         Catch1.Type = this.VisitTypeReference(Catch1.Type, Catch2.Type);
         Catch1.Block = this.VisitBlock(Catch1.Block, Catch2.Block);
     }
     return Catch1;
 }
Ejemplo n.º 35
0
 protected static void Try(Action callback)
 {
     thrown = Catch.Exception(callback);
 }
Ejemplo n.º 36
0
 protected override void Because()
 {
     thrown = Catch.Exception(() => ((ICommitEvents)Store).Commit(invalidStreamRevision));
 }
Ejemplo n.º 37
0
 public void TestNoCatchOfException()
 {
     var modelData = new Hashtable();
     modelData.Add("Existing", "Hi");
     modelData.Add("Model", new Hashtable());
     var tag = new Catch();
     tag.Var = new MockAttribute(new Constant("error"));
     tag.Body = new MockAttribute(new Property("Existing"));
     var model = new TagModel(modelData);
     Assert.That(tag.Evaluate(model), Is.EqualTo("Hi"));
     Assert.That(model["Model.error"], Is.Null);
 }
Ejemplo n.º 38
0
 protected override void Because()
 {
     thrown = Catch.Exception(() => hook.PreCommit(Attempt));
 }
Ejemplo n.º 39
0
 public override Statement VisitCatch(Catch Catch)
 {
     if (Catch == null) return null;
     return base.VisitCatch((Catch)Catch.Clone());
 }
Ejemplo n.º 40
0
 protected override void Because()
 {
     _exception = Catch.Exception(() => _position = _positionParser.Parse(_positionText));
 }
Ejemplo n.º 41
0
 public override Statement VisitCatch(Catch Catch)
 {
   throw new ApplicationException("unimplemented");
 }
 protected override void When() => CaughtException = Catch.Exception(() => FlavoursConfiguration = new FlavoursConfiguration(true));
Ejemplo n.º 43
0
 protected internal override void TraverseCatch(Catch @catch)
 {
     Dispatch(@catch);
 }
 public void When_persist_streams_is_null_then_should_throw()
 {
     Catch.Exception(() => new PollingClientRx(null)).Should().BeOfType <ArgumentNullException>();
 }
Ejemplo n.º 45
0
 public override Statement VisitCatch(Catch Catch){
   if (Catch == null) return null;
   this.VisitResolvedTypeReference(Catch.Type, Catch.TypeExpression);
   return base.VisitCatch(Catch);
 }
 public void When_interval_is_zero_then_should_throw()
 {
     Catch.Exception(() => new PollingClientRx(A.Fake <IPersistStreams>(), 0)).Should().BeOfType <ArgumentException>();
 }
Ejemplo n.º 47
0
void case_995()
#line 6642 "cs-parser.jay"
{
	  	var c = new Catch ((ExplicitBlock) yyVals[0+yyTop], GetLocation (yyVals[-2+yyTop]));
	  	c.Filter = (CatchFilterExpression) yyVals[-1+yyTop];
	  	yyVal = c;
	  }
 protected override void When() => CaughtException = Catch.Exception(() => FlavoursConfiguration = HostedEnvironment.FlavoursConfiguration);
Ejemplo n.º 49
0
void case_998()
#line 6669 "cs-parser.jay"
{
	  	if (yyToken == Token.CLOSE_PARENS) {
			report.Error (1015, lexer.Location,
				"A type that derives from `System.Exception', `object', or `string' expected");
		} else {
			Error_SyntaxError (yyToken);
		}
		
		yyVal = new Catch (null, GetLocation (yyVals[-2+yyTop]));
	  }
Ejemplo n.º 50
0
 public override void When() => _exception = Catch.Exception(() =>
                                                             _result = Text.Create(_rawText)
                                                             );
Ejemplo n.º 51
0
 public virtual Statement VisitCatch(Catch Catch){
   if (Catch == null) return null;
   Catch.Variable = this.VisitTargetExpression(Catch.Variable);
   Catch.Type = this.VisitTypeReference(Catch.Type);
   Catch.Block = this.VisitBlock(Catch.Block);
   return Catch;
 }
        public void When_There_Is_No_Message_In_The_Inbox()
        {
            var exception = Catch.Exception(() => _dynamoDbInbox.Get <MyCommand>(Guid.NewGuid(), "some key"));

            AssertionExtensions.Should((object)exception).BeOfType <RequestNotFoundException <MyCommand> >();
        }
Ejemplo n.º 53
0
 /**
  * Call back method that must be called as soon as the given <code>
  * Catch</code> object has been traversed.
  *
  * @param pCatchClause  The <code>Catch</code> object that has
  *                      just been traversed.
  */
 public void actionPerformed(
      Catch pCatchClause)
 {
     // Nothing to do.
 }
 Exception get_exception_thrown_by(Action action)
 {
     return(Catch.Exception(action));
 }
Ejemplo n.º 55
0
 public virtual Catch GetClosestMatch(Catch/*!*/ nd1, CatchList/*!*/ list1, CatchList list2, int list1pos, ref int list2start,
   TrivialHashtable/*!*/ matchedNodes, out Differences closestDifferences, out int list2pos) {
   closestDifferences = null; list2pos = -1;
   if (list2 == null) return null;
   if (nd1 == null || list1 == null || matchedNodes == null || list1pos < 0 || list1pos >= list1.Count || list2start < 0 || list2start >= list2.Count) {
     Debug.Assert(false); return null;
   }
   Catch closest = null;
   Differences winnerSoFar = null;
   for (int j = list2start, m = list2.Count; j < m; j++){
     Catch nd2 = list2[j];
     if (list2start == j) list2start++;
     if (nd2 == null) continue;
     if (matchedNodes[nd2.UniqueKey] != null) continue;
     Differences diff = this.GetDifferences(nd1, nd2);
     if (diff == null){Debug.Assert(false); continue;}
     if (diff.Similarity <= 0.5){
       //Not a good enough match
       if (list2start == j+1) list2start--; //The next call to GetClosestMatch will start looking at list2start, so this node will be considered then
       continue; //ignore it for the rest of this call
     }
     if (winnerSoFar != null && winnerSoFar.Similarity >= diff.Similarity) continue;
     winnerSoFar = closestDifferences = diff;
     closest = nd2;
     list2pos = j;
     if (diff.NumberOfDifferences == 0) return closest; //Perfect match, no need to look for other matches
   }
   if (closest != null){
     //^ assert winnerSoFar != null;
     //closest is closer to nd1 than any other node in list2, but this is no good if some other node in list1 has a better claim on closest
     for (int i = list1pos+1, n = list1.Count; i < n; i++){
       Catch nd1alt = list1[i];
       if (nd1alt == null) continue;
       if (matchedNodes[nd1alt.UniqueKey] != null) continue;
       Differences diff = this.GetDifferences(nd1alt, closest);
       if (diff == null){Debug.Assert(false); continue;}
       if (diff.Similarity <= winnerSoFar.Similarity) continue;
       //nd1alt has a better claim on closest. See if it wants closest.
       Differences diff2;
       int j, k = list2start;
       Catch nd2alt = this.GetClosestMatch(nd1alt, list1, list2, i, ref k,  matchedNodes, out diff2, out j);
       if (nd2alt != closest){
         Debug.Assert(nd2alt != null && diff2 != null && diff2.Similarity >= diff.Similarity);
         continue; //nd1alt prefers nd2alt to closest, so closest is still available
       }
       //nd1alt wants closest, take it out of the running
       matchedNodes[closest.UniqueKey] = nd1alt;
       //Now that closest is out of the running, try again
       k = list2start;
       Catch newClosest = this.GetClosestMatch(nd1, list1, list2, i, ref k, matchedNodes, out winnerSoFar, out list2pos);
       //put closest back in the running so that the next call to this routine will pick it up
       matchedNodes[closest.UniqueKey] = closest;
       closest = newClosest;
       break;
     }
   }
   closestDifferences = winnerSoFar;
   return closest;
 }
 protected override void Because()
 {
     _thrown = Catch.Exception(() => Hook.PreCommit(_failedAttempt));
 }
Ejemplo n.º 57
0
        private int InsertIntoArticle(DataAccess dac, Article art, Catch info)
        {
            //插入数据库
               var counter = 0;
            try
            {
                     counter = dac.ExecuteNonQuery(DataAccess.ConnManagementMode.Manual, false,
                                        @"DECLARE @article_id INT
            SELECT  @article_id = id
            FROM    dbo.sf_Article
            WHERE   url = @url
            OR title = @title
            IF @article_id IS NULL
            BEGIN
            INSERT  INTO [sf_Article]
                ( [guid] ,
                  [title] ,
                  [body] ,
                  [site] ,
                  [url] ,
                  [publish_time] ,
                  [create_time]
                )
            VALUES  ( @guid ,
                  @title ,
                  @body ,
                  @site ,
                  @url ,
                  @publish_time ,
                  @create_time
                )
            SET @article_id = SCOPE_IDENTITY()
            END
            ELSE
             BEGIN
            UPDATE  [sf_Article]
                  SET [guid]=@guid ,
                  [title]=@title ,
                  [body] =@body ,
                  [site] =@site ,
                  [url]=@url ,
                  [publish_time] =@publish_time ,
                  [create_time]=@create_time
            WHERE id=@article_id
            END
            IF NOT EXISTS ( SELECT  1
                FROM    dbo.sf_Map_ArtCls
                WHERE   article_id = @article_id
                        AND class_id = @class_id )
            BEGIN
            INSERT  INTO [sf_Map_ArtCls]
                ( [guid] ,
                  [article_id] ,
                  [class_id] ,
                  [display_order]

                )
            VALUES  ( @guid2 ,
                  @article_id ,
                  @class_id ,
                  @display_order

                )
            END
                 ",
                                        dac.CreateParameter("@guid", art.Guid), dac.CreateParameter("@title", art.Title),
                                        dac.CreateParameter("@body", art.Body), dac.CreateParameter("@site", art.Site),
                                        dac.CreateParameter("@url", art.Url), dac.CreateParameter("@publish_time", art.PublishTime),
                                        dac.CreateParameter("@create_time", art.CreateTime),
                                        dac.CreateParameter("@guid2", Guid.NewGuid()), dac.CreateParameter("@class_id", info.ClassId),
                                        dac.CreateParameter("@display_order", 0));
            }
            catch
            {
                counter = 0;
            }
            if (counter < 0)
                counter = 0;
            return counter;
        }
 protected override void Because()
 {
     _thrown = Catch.Exception(() => Hook.PreCommit(_beyondEndOfStream));
 }
Ejemplo n.º 59
0
 public virtual Catch VisitCatch(Catch Catch, Catch changes, Catch deletions, Catch insertions){
   this.UpdateSourceContext(Catch, changes);
   if (Catch == null) return changes;
   if (changes != null){
     if (deletions == null || insertions == null)
       Debug.Assert(false);
     else{
       Catch.Block = this.VisitBlock(Catch.Block, changes.Block, deletions.Block, insertions.Block);
       Catch.Type = this.VisitTypeReference(Catch.Type, changes.Type);
       Catch.Variable = this.VisitExpression(Catch.Variable, changes.Variable, deletions.Variable, insertions.Variable);
     }
   }else if (deletions != null)
     return null;
   return Catch;
 }
Ejemplo n.º 60
0
 protected override void Because()
 {
     thrown = Catch.Exception(() => Store.OpenStream(null, int.MaxValue));
 }