Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
feat: Job and JobManager tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-wff committed Dec 2, 2023
1 parent 521fe40 commit b8c77ee
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
35 changes: 35 additions & 0 deletions EasySave.Tests/EasyLib/JobManagerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using EasyLib;
using EasyLib.Enums;

namespace EasySave.Tests.EasyLib;

public class JobManagerTests
{
[Fact]
public void CreateJob_ShouldCreateJob()
{
// Arrange
var jobManager = new JobManager();

// Act
jobManager.CreateJob("job1", "C:\\", "D:\\", JobType.Full);

// Assert
Assert.Single(jobManager.GetJobs());
}

[Fact]
public void DeleteJob_ShouldDeleteJob()
{
// Arrange
var jobManager = new JobManager();
jobManager.CreateJob("job1", "C:\\", "D:\\", JobType.Full);
var job = jobManager.GetJobs().First();

// Act
jobManager.DeleteJob(job);

// Assert
Assert.Empty(jobManager.GetJobs());
}
}
27 changes: 27 additions & 0 deletions EasySave.Tests/EasyLib/JobTests/JobTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using EasyLib.Enums;
using EasyLib.Job;

namespace EasySave.Tests.EasyLib.JobTests;

public class JobTests
{
[Fact]
public void CreateJob_ShouldCreateJob()
{
// Arrange
const string jobName = "job1";
const string sourcePath = "C:\\";
const string targetPath = "D:\\";
const JobType jobType = JobType.Full;

// Act
var job = new Job(jobName, sourcePath, targetPath, jobType);

// Assert
job.Name.Should().Be(jobName);
job.SourceFolder.Should().Be(sourcePath);
job.DestinationFolder.Should().Be(targetPath);
job.Type.Should().Be(jobType);
job.State.Should().Be(JobState.End);
}
}

0 comments on commit b8c77ee

Please sign in to comment.