public void AddParagraphToDb_ExpectedParameters_Ok() { paragraphDataAccess.Add(paragraph); Paragraph obtained = paragraphDataAccess.Get(paragraph.Id); Assert.AreEqual(paragraph, obtained); }
public void DeleteDocumentFromDb_ExpectedParametersAndParagraphToDelete_Ok() { Margin margin = new Margin(MarginAlign.HEADER, "aStyleClass"); margin.SetText(new Text()); aDocumentPart.PutTextAtLast(new Text()); document.AddDocumentParagraphAtLast(aDocumentPart); document.SetDocumentMargin(margin.Align, margin); documentDataAccess.Add(document); documentDataAccess.Delete(document.Id); Document obtained = documentDataAccess.Get(document.Id); Paragraph paragraphObtained = paragraphDataAccess.Get(aDocumentPart.Id); ITextDataAccess txtDA = new TextDataAccess(); Text text1 = txtDA.Get(margin.GetText().Id); Text text2 = txtDA.Get(aDocumentPart.GetTextAt(0).Id); Assert.IsNull(obtained); Assert.IsNull(paragraphObtained); Assert.IsNull(text1); Assert.IsNull(text2); }
public bool AreEqual(Guid firstParagraphId, Guid secondParagraphId) { if (!paragraphDataAccess.Exists(firstParagraphId)) { throw new ArgumentException("The first paragraph argument not exist in database." , "firstParagraphId"); } if (!paragraphDataAccess.Exists(secondParagraphId)) { throw new ArgumentException("The second paragraph argument not exist in database." , "secondParagraphId"); } Paragraph firstParagraph = paragraphDataAccess.Get(firstParagraphId); Paragraph secondParagraph = paragraphDataAccess.Get(secondParagraphId); return(firstParagraph.Equals(secondParagraph)); }