pacserver/src/Pacserver.Tests/checkIfDatabasesWereModifiedTest.cs
ProfessionalUwU 1994e92e9e
Minor changes && Add tests
Made a seperate method for writing the database access time files
Added tests for checkIfDatabasesWereModified
2023-06-18 17:24:56 +02:00

31 lines
921 B
C#

using Pacserver.Utils;
namespace Pacserver.Tests;
public class checkIfDatabasesWereModifiedTest {
[Fact]
public void checkIfDatabasesWereModified_throwsExceptionIfNoValidModeIsGiven() {
// Arrange
PacserverUtils utils = new PacserverUtils();
utils.readPacmanConfig();
// Act
Action act = () => utils.checkIfDatabasesWereModified("test", "/tmp/test.txt");
// Assert
act.Should().Throw<ArgumentException>().WithMessage("No valid mode was given. Valid modes are before and after");
}
[Fact]
public void checkIfDatabasesWereModified_throwsNoExceptionIfValidModeIsGiven() {
// Arrange
PacserverUtils utils = new PacserverUtils();
utils.readPacmanConfig();
// Act
Action act = () => utils.checkIfDatabasesWereModified("before", "/tmp/test.txt");
// Assert
act.Should().NotThrow();
}
}