public void Given_no_ancestors_When_GetThisAndAllAncestors_called_Then_one_site_returned() { //Given var site = new Site() {Id = 123, Parent = null}; //when var result = site.GetThisAndAllAncestors(); Assert.That(result.Count, Is.EqualTo(1)); }
public void Given_one_ancestors_When_GetThisAndAllAncestors_called_Then_two_site_returned() { //Given var ansectorOne = new Site() {Id = 123123, Parent = null, Name = "Parent"}; var site = new Site() {Id = 123, Parent = ansectorOne, Name = "the site"}; var childSite = new Site() {Id = 432523, Parent = site, Name = "Child"}; //when var result = site.GetThisAndAllAncestors(); Assert.That(result.Count, Is.EqualTo(2)); Assert.That(result.Exists(x=> x.Name == ansectorOne.Name), Is.EqualTo(true)); Assert.That(result.Exists(x => x.Name == site.Name), Is.EqualTo(true)); }