public void PersonRepoGetById() { var context = TestContext.GetContext(); var repo = new PartRepo(context); var part = repo.GetById(1); output.WriteLine(part.ToJsonString(ignoreSupplierToParts)); Assert.True(part.IsEqual(context.Parts[0], ignoreSupplierToParts)); Assert.Equal(1, part.PartId); Assert.Equal("Nut", part.PartName); Assert.Equal("Brass", part.Material); }
public void PartRepoGetById(int id) { var expectedJsonFile = $"PartRepo\\GetById\\expected{id}.json"; NutsAndBoltsContext context = ContextFactory.GetContext(); var repo = new PartRepo(context); Part actual = repo.GetById(id); Part expected = JToken.Parse(File.ReadAllText(expectedJsonFile)).ToObject <Part>(); string actualJson = actual.ToJsonString(); string expectedJson = expected.ToJsonString(); string sideBySide = FileStringComparer.GetSideBySideFileStrings(expectedJson, actualJson, "EXPECTED", "ACTUAL"); output.WriteLine(sideBySide); Assert.Equal(expectedJson, actualJson); }