private void FindRemovableTypesInAssertStmt(AssertStmt assert, Statement parent, Method method) { if (!(parent is BlockStmt)) { return; } var block = (BlockStmt)parent; var assertWrap = new Wrap <Statement>(assert, block.Body); _allRemovableTypes.AddAssert(assertWrap, method); }
/// <summary> /// Removes unnecessary parts of asserts (e.g. combined by && where one part is not needed) /// </summary> /// <returns></returns> public List <Tuple <Statement, Statement> > GetSimplifiedAsserts() { var simplifier = new Simplifier(Program); var wrappedAsserts = simplifier.GetSimplifiedItems(AllRemovableTypes.Asserts); var asserts = new List <Tuple <Statement, Statement> >(); foreach (var assert in wrappedAsserts) { AllRemovableTypes.AddAssert(assert.Item2, AllRemovableTypes.FindMemberFromAssertWrap(assert.Item1)); AllRemovableTypes.RemoveAssert(assert.Item1); asserts.Add(new Tuple <Statement, Statement>(assert.Item1.Removable, assert.Item2.Removable)); } return(asserts); }