public static void IsEquivalentTo <T>(this ISaveFile <T> actual, ISaveFile <T> expected) where T : ISaveData { Asserter.Against(actual) .WithHeading($"First {actual.GetType().Prettify()} must be equivalent to the second {expected.GetType().Prettify()}") .And(Has.Property(nameof(actual.Nickname)).EqualTo(expected.Nickname)) .And(Has.Property(nameof(actual.TimeStamp)).EqualTo(expected.TimeStamp)) .And(Has.Property(nameof(actual.Data)).EqualTo(expected.Data)) .Invoke(); }
internal static void MustExist(this ISaveFile <ISaveData>?saveFile) { if (saveFile == null) { throw new ArgumentNullException(nameof(saveFile)); } saveFile.FileSystemInfo.Refresh(); if (saveFile.FileSystemInfo.Exists == false) { throw new FileNotFoundException($"The file referenced by the {saveFile.GetType().Prettify()} {saveFile.Nickname} does not exist!"); } }