public async Task ShouldCompareTwoContextWithSimpleContent() { using (SampleContext expectedContext = GetSimpleTestContext()) { using (SampleContext appContext = new XmlFileContext <SampleContext>(this.GetType()).Empty()) { appContext.Authors.Add(new Author() { FirstName = "Cedric123" }); appContext.SaveChanges(); //compare context var comparisonResult = await appContext.CompareTo(expectedContext); string s = await appContext.AsXmlAsync(); string s2 = await expectedContext.AsXmlAsync(ContextDataEnum.All); comparisonResult.AreEqual.ShouldBe(false, comparisonResult.ToString()); comparisonResult.Differences.Count.ShouldBe(2); comparisonResult.Differences[0].ToString() .ShouldBe("Author.FirstName Should be [Cedric] but was [Cedric123] - object with AUT_ID : 1"); } } }
public async Task ShouldCompareEmptyContext() { using (SampleContext emptyContext1 = new XmlFileContext<SampleContext>(this.GetType()).Empty()) { using (SampleContext emptyContext2 = new XmlFileContext<SampleContext>(this.GetType()).Empty()) { var comparisonResult = await emptyContext1.CompareTo(emptyContext2); comparisonResult.AreEqual.ShouldBe(true, comparisonResult.ToString()); } } }
public async Task ShouldCompareEmptyContext() { using (SampleContext emptyContext1 = new XmlFileContext <SampleContext>(this.GetType()).Empty()) { using (SampleContext emptyContext2 = new XmlFileContext <SampleContext>(this.GetType()).Empty()) { var comparisonResult = await emptyContext1.CompareTo(emptyContext2); comparisonResult.AreEqual.ShouldBe(true, comparisonResult.ToString()); } } }
public async Task ShouldCompareTwoContextWithSimpleContent() { using (SampleContext expectedContext = GetSimpleTestContext()) { using (SampleContext appContext = new XmlFileContext<SampleContext>(this.GetType()).Empty()) { appContext.Authors.Add(new Author() { FirstName = "Cedric123" }); appContext.SaveChanges(); //compare context var comparisonResult = await appContext.CompareTo(expectedContext); string s = await appContext.AsXmlAsync(); string s2 = await expectedContext.AsXmlAsync(ContextDataEnum.All); comparisonResult.AreEqual.ShouldBe(false, comparisonResult.ToString()); comparisonResult.Differences.Count.ShouldBe(2); comparisonResult.Differences[0].ToString() .ShouldBe("Author.FirstName Should be [Cedric] but was [Cedric123] - object with AUT_ID : 1"); } } }