private void RecordsFrom(Reachability r1) { foreach (var o in r1.AllObservers) { r1.RecordsFrom(o).Should().NotBeNull(); } }
private static IEnumerable <Proto.Msg.ObserverReachability> ReachabilityToProto(Reachability reachability, Dictionary <UniqueAddress, int> addressMapping) { var builderList = new List <Proto.Msg.ObserverReachability>(); foreach (var version in reachability.Versions) { var subjectReachability = reachability.RecordsFrom(version.Key).Select( r => { var sr = new Proto.Msg.SubjectReachability(); sr.AddressIndex = MapWithErrorMessage(addressMapping, r.Subject, "address"); sr.Status = (Proto.Msg.SubjectReachability.Types.ReachabilityStatus)r.Status; sr.Version = r.Version; return(sr); }); var observerReachability = new Proto.Msg.ObserverReachability(); observerReachability.AddressIndex = MapWithErrorMessage(addressMapping, version.Key, "address"); observerReachability.Version = version.Value; observerReachability.SubjectReachability.AddRange(subjectReachability); builderList.Add(observerReachability); } return(builderList); }