Example #1
0
        public void TestBackupSaveSlots()
        {
            const string nickName = nameof(TestBackupSaveSlots);

            DeleteSaveFiles(nickName);

            var newSave = new SaveDataTestImpl(nickName);

            Assume.That(newSave.AllSaveFilePaths, Is.Empty);

            for (int numberOfSaveFiles = 1; numberOfSaveFiles < SaveData.BackupSaveSlots * 2; numberOfSaveFiles++)
            {
                newSave.Save(false);

                Log($"Created new save file:[{numberOfSaveFiles}] {newSave}");

                Assert.That(newSave.AllSaveFilePaths.Length, Is.LessThanOrEqualTo(SaveData.BackupSaveSlots), $"There should never be more than {SaveData.BackupSaveSlots} save files!");

                Assert.That(
                    newSave.AllSaveFilePaths.Length,
                    Is.EqualTo(
                        Math.Min(numberOfSaveFiles, SaveData.BackupSaveSlots)
                        ),
                    $"Didn't find the correct number of saves!" +
                    $"\n\t{string.Join("\n\t", SaveDataTestImpl.GetAllSaveFilePaths(newSave.Nickname))}"
                    );
            }
        }
Example #2
0
 private static void _TestTrimSaveFiles(int trimTo)
 {
     Assume.That(trimTo, Is.LessThanOrEqualTo(DummySaveDates.Count));
     MakeDummyFiles();
     SaveDataTestImpl.TrimSaves(DummyNickName, trimTo);
     Assert.That(GetExistingSaveFiles().Count, Is.EqualTo(trimTo), "The incorrect number of files remained after trimming!");
 }
Example #3
0
        public void TestDefaultTableCapacity()
        {
            var table = SerializerRepository.InitializeDefaultTable(new SerializationContext());

            Assert.That(table.Count, Is.LessThanOrEqualTo(SerializerRepository.DefaultTableCapacity));
        }
Example #4
0
 /// <summary>
 /// Verifies that the first value is less than or equal to the second
 /// value. If it is not, then an
 /// <see cref="AssertionException"/> is thrown.
 /// </summary>
 /// <param name="arg1">The first value, expected to be less</param>
 /// <param name="arg2">The second value, expected to be greater</param>
 /// <param name="message">The message to display in case of failure</param>
 /// <param name="args">Array of objects to be used in formatting the message</param>
 public static void LessOrEqual(long arg1, long arg2, string message, params object[] args)
 {
     Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
 }
Example #5
0
 /// <summary>
 /// Verifies that the first value is less than or equal to the second
 /// value. If it is not, then an
 /// <see cref="AssertionException"/> is thrown.
 /// </summary>
 /// <param name="arg1">The first value, expected to be less</param>
 /// <param name="arg2">The second value, expected to be greater</param>
 //[CLSCompliant(false)]
 public static void LessOrEqual(uint arg1, uint arg2)
 {
     Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
 }
Example #6
0
 /// <summary>
 /// Verifies that the first value is less than or equal to the second
 /// value. If it is not, then an
 /// <see cref="AssertionException"/> is thrown.
 /// </summary>
 /// <param name="arg1">The first value, expected to be less</param>
 /// <param name="arg2">The second value, expected to be greater</param>
 public static void LessOrEqual(IComparable arg1, IComparable arg2)
 {
     Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
 }
 /// <summary>
 /// Verifies that the first value is less than or equal to the second
 /// value. If it is not, then an
 /// <see cref="AssertionException"/> is thrown.
 /// </summary>
 /// <param name="arg1">The first value, expected to be less</param>
 /// <param name="arg2">The second value, expected to be greater</param>
 public static void LessOrEqual(decimal arg1, decimal arg2)
 {
     Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
 }