Created CA follow up worker
This commit is contained in:
101
FabApprovalWorkerServiceTests/CorrectiveActionServiceTests.cs
Normal file
101
FabApprovalWorkerServiceTests/CorrectiveActionServiceTests.cs
Normal file
@ -0,0 +1,101 @@
|
||||
using FabApprovalWorkerService.Models;
|
||||
using FabApprovalWorkerService.Services;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using Moq;
|
||||
|
||||
namespace FabApprovalWorkerServiceTests;
|
||||
|
||||
public class CorrectiveActionServiceTests {
|
||||
private Mock<ILogger<CorrectiveActionService>> _mockLogger;
|
||||
private Mock<IDalService> _mockDalService;
|
||||
|
||||
private CorrectiveActionService _caService;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() {
|
||||
_mockLogger = new Mock<ILogger<CorrectiveActionService>>();
|
||||
_mockDalService = new Mock<IDalService>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CAServiceWithNullLoggerShouldThrowException() {
|
||||
Assert.Throws<ArgumentNullException>(() => new CorrectiveActionService(null, _mockDalService.Object));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CAServiceWithNullDalServiceShouldThrowException() {
|
||||
Assert.Throws<ArgumentNullException>(() => new CorrectiveActionService(_mockLogger.Object, null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCorrectiveActionsWithFollowUpInFiveDaysDbErrorShouldThrowError() {
|
||||
_mockDalService.Setup(d => d.QueryAsync<CorrectiveAction>(It.IsAny<string>())).Throws(new Exception());
|
||||
|
||||
_caService = new CorrectiveActionService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _caService.GetCorrectiveActionsWithFollowUpInFiveDays());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task GetCorrectiveActionsWithFollowUpInFiveDaysShouldReturnExpectedCAs() {
|
||||
IEnumerable<CorrectiveAction> expectedCAs = new List<CorrectiveAction>() {
|
||||
new CorrectiveAction() {
|
||||
CANo = 1,
|
||||
CATitle = "title"
|
||||
},
|
||||
new CorrectiveAction() {
|
||||
CANo = 2,
|
||||
CATitle = "title"
|
||||
},
|
||||
new CorrectiveAction() {
|
||||
CANo = 3,
|
||||
CATitle = "title"
|
||||
}
|
||||
};
|
||||
|
||||
_mockDalService.Setup(d => d.QueryAsync<CorrectiveAction>(It.IsAny<string>())).Returns(Task.FromResult(expectedCAs));
|
||||
|
||||
_caService = new CorrectiveActionService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
IEnumerable<CorrectiveAction> actualCAs = await _caService.GetCorrectiveActionsWithFollowUpInFiveDays();
|
||||
|
||||
Assert.That(expectedCAs, Is.EquivalentTo(actualCAs));
|
||||
}
|
||||
|
||||
//CreateCorrectiveActionFollowUpApproval
|
||||
[Test]
|
||||
public void CreateCorrectiveActionFollowUpApprovalWithInvalidCaNoShouldThrowException() {
|
||||
_caService = new CorrectiveActionService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _caService.CreateCorrectiveActionFollowUpApproval(0, 5));
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _caService.CreateCorrectiveActionFollowUpApproval(-5, 5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateCorrectiveActionFollowUpApprovalWithInvalidQaIdShouldThrowException() {
|
||||
_caService = new CorrectiveActionService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _caService.CreateCorrectiveActionFollowUpApproval(5, 0));
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _caService.CreateCorrectiveActionFollowUpApproval(5, -5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateCorrectiveActionFollowUpApprovalDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.ExecuteAsync(It.IsAny<string>())).Throws(new Exception());
|
||||
|
||||
_caService = new CorrectiveActionService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _caService.CreateCorrectiveActionFollowUpApproval(5, 5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task CreateCorrectiveActionFollowUpApprovalShouldExecuteSql() {
|
||||
_caService = new CorrectiveActionService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
await _caService.CreateCorrectiveActionFollowUpApproval(5, 5);
|
||||
|
||||
_mockDalService.Verify(d => d.ExecuteAsync(It.IsAny<string>()), Times.Once());
|
||||
}
|
||||
}
|
@ -43,7 +43,7 @@ internal class ECNServiceTests {
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _ecnService.GetExpiredTECNs());
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _ecnService.GetExpiredTECNsInPastDay());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -67,7 +67,7 @@ internal class ECNServiceTests {
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
IEnumerable<ECN> actual = await _ecnService.GetExpiredTECNs();
|
||||
IEnumerable<ECN> actual = await _ecnService.GetExpiredTECNsInPastDay();
|
||||
|
||||
Assert.That(actual, Is.Empty);
|
||||
}
|
||||
@ -137,7 +137,7 @@ internal class ECNServiceTests {
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
IEnumerable<ECN> actual = await _ecnService.GetExpiredTECNs();
|
||||
IEnumerable<ECN> actual = await _ecnService.GetExpiredTECNsInPastDay();
|
||||
|
||||
Assert.That(actual.Count(), Is.EqualTo(3));
|
||||
}
|
||||
@ -209,7 +209,7 @@ internal class ECNServiceTests {
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
IEnumerable<ECN> actual = await _ecnService.GetExpiredTECNs();
|
||||
IEnumerable<ECN> actual = await _ecnService.GetExpiredTECNsInPastDay();
|
||||
|
||||
Assert.That(actual.Count(), Is.EqualTo(2));
|
||||
}
|
||||
@ -274,7 +274,8 @@ internal class ECNServiceTests {
|
||||
new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title"
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now
|
||||
}
|
||||
};
|
||||
|
||||
@ -286,4 +287,150 @@ internal class ECNServiceTests {
|
||||
|
||||
Assert.That(expectedEcns.First(), Is.EqualTo(actualEcn));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredNullEcnShouldThrowException() {
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => _ecnService.EcnIsExpired(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnTrueWhenBeforeToday() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(-2),
|
||||
IsTECN = true
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.True(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnTrueWhenToday() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date,
|
||||
IsTECN = true
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.True(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnFalseWhenAfterToday() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(2),
|
||||
IsTECN = true
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.False(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnFalseWhenExtended() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(-2),
|
||||
ExtensionDate = DateTime.Now.Date.AddDays(5),
|
||||
IsTECN = true
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.False(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnTrueWhenExtensionIsBeforeToday() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(-10),
|
||||
ExtensionDate = DateTime.Now.Date.AddDays(-5),
|
||||
IsTECN = true
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.True(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnFalseWhenNotTecn() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(-2),
|
||||
IsTECN = false
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.False(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnFalseWhenClosed() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(-2),
|
||||
IsTECN = false,
|
||||
CloseDate = DateTime.Now.AddDays(-2)
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.False(isExpired);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EcnIsExpiredShouldReturnTrueWhenNotClosed() {
|
||||
ECN ecn = new ECN() {
|
||||
ECNNumber = 1,
|
||||
OriginatorID = 1,
|
||||
Title = "title",
|
||||
ExpirationDate = DateTime.Now.Date.AddDays(-2),
|
||||
IsTECN = true
|
||||
};
|
||||
|
||||
_ecnService = new ECNService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
bool isExpired = _ecnService.EcnIsExpired(ecn);
|
||||
|
||||
Assert.True(isExpired);
|
||||
}
|
||||
}
|
||||
|
@ -61,15 +61,6 @@ internal class SmtpServiceTests {
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendMailWithEmptyccRecipientsShouldThrowException() {
|
||||
_smtpService = new SmtpService(_mockLogger.Object, _mockSmtpClient.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentNullException>(async Task () => {
|
||||
await _smtpService.SendEmail(ADDRESS_LIST, new List<MailAddress>(), "subject", "body");
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendMailWithNullSubjectShouldThrowException() {
|
||||
_smtpService = new SmtpService(_mockLogger.Object, _mockSmtpClient.Object);
|
||||
|
@ -2,6 +2,7 @@
|
||||
using FabApprovalWorkerService.Services;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Identity.Client;
|
||||
|
||||
using Moq;
|
||||
|
||||
@ -27,8 +28,6 @@ public class TrainingServiceTests {
|
||||
public void TrainingServiceWithNullDalServiceShouldThrowException() {
|
||||
Assert.Throws<ArgumentNullException>(() => new TrainingService(_mockLogger.Object, null));
|
||||
}
|
||||
<<<<<<< Updated upstream
|
||||
=======
|
||||
|
||||
[Test]
|
||||
public void DeleteDocAssignmentWithInvalidIdShouldThrowException() {
|
||||
@ -61,7 +60,7 @@ public class TrainingServiceTests {
|
||||
public void DeleteTrainingAssignmentWithInvalidIdShouldThrowException() {
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.DeleteTrainingAssignment(-1));
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.DeleteTrainingAssignmentsByTrainingId(-1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -70,7 +69,7 @@ public class TrainingServiceTests {
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _trainingService.DeleteTrainingAssignment(1));
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _trainingService.DeleteTrainingAssignmentsByTrainingId(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -79,7 +78,7 @@ public class TrainingServiceTests {
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
await _trainingService.DeleteTrainingAssignment(3);
|
||||
await _trainingService.DeleteTrainingAssignmentsByTrainingId(3);
|
||||
|
||||
_mockDalService.Verify(d => d.ExecuteAsync(It.IsAny<string>()));
|
||||
}
|
||||
@ -238,5 +237,101 @@ public class TrainingServiceTests {
|
||||
|
||||
_mockDalService.Verify(d => d.ExecuteAsync(It.IsAny<string>()), Times.Once());
|
||||
}
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
[Test]
|
||||
public void GetEcnNumberByTrainingIdInvalidIdShouldThrowException() {
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.GetEcnNumberByTrainingId(0));
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.GetEcnNumberByTrainingId(-1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetEcnNumberByTrainingIdDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.QueryAsync<int>(It.IsAny<string>())).Throws(new Exception());
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _trainingService.GetEcnNumberByTrainingId(9));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetEcnNumberByTrainingIdEcnNumberNotFoundShouldThrowException() {
|
||||
IEnumerable<int> expectedIds = new List<int>();
|
||||
|
||||
_mockDalService.Setup(d => d.QueryAsync<int>(It.IsAny<string>())).Returns(Task.FromResult(expectedIds));
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _trainingService.GetEcnNumberByTrainingId(9));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task GetEcnNumberByTrainingIdShouldReturnExpectedId() {
|
||||
IEnumerable<int> expectedIds = new List<int>() { 1 };
|
||||
|
||||
_mockDalService.Setup(d => d.QueryAsync<int>(It.IsAny<string>())).Returns(Task.FromResult(expectedIds));
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
int actualId = await _trainingService.GetEcnNumberByTrainingId(9);
|
||||
|
||||
Assert.That(expectedIds.First(), Is.EqualTo(actualId));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteTrainingAssignmentByIdWithInvalidIdShouldThrowException() {
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.DeleteTrainingAssignmentById(0));
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.DeleteTrainingAssignmentById(-7));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteTrainingAssignmentByIdWithDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.ExecuteAsync(It.IsAny<string>())).Throws(new Exception());
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _trainingService.DeleteTrainingAssignmentById(9));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task DeleteTrainingAssignmentByIdShouldExecuteSql() {
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
await _trainingService.DeleteTrainingAssignmentById(9);
|
||||
|
||||
_mockDalService.Verify(d => d.ExecuteAsync(It.IsAny<string>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetTrainingAssignmentIdsByUserIdWithInvalidIdShouldThrowException() {
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.GetTrainingAssignmentIdsByUserId(0));
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _trainingService.GetTrainingAssignmentIdsByUserId(-9));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetTrainingAssignmentIdsByUserIdWithDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.QueryAsync<int>(It.IsAny<string>())).Throws(new Exception());
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<Exception>(async Task () => await _trainingService.GetTrainingAssignmentIdsByUserId(9));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task GetTrainingAssignmentIdsByUserIdShouldReturnExpectedIds() {
|
||||
IEnumerable<int> expectedIds = new List<int> { 1, 2, 3 };
|
||||
|
||||
_mockDalService.Setup(d => d.QueryAsync<int>(It.IsAny<string>())).Returns(Task.FromResult(expectedIds));
|
||||
|
||||
_trainingService = new TrainingService(_mockLogger.Object, _mockDalService.Object);
|
||||
|
||||
IEnumerable<int> actualIds = await _trainingService.GetTrainingAssignmentIdsByUserId(9);
|
||||
|
||||
Assert.That(expectedIds, Is.EquivalentTo(actualIds));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ using FabApprovalWorkerService.Models;
|
||||
using FabApprovalWorkerService.Services;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Identity.Client;
|
||||
|
||||
using Moq;
|
||||
|
||||
@ -73,7 +72,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task GetAllExpiredOOOUsersDbErrorShouldThrowException() {
|
||||
public void GetAllExpiredOOOUsersDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.QueryAsync<User>(It.IsAny<string>())).ThrowsAsync(new Exception("whoops!"));
|
||||
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
@ -93,7 +92,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task GetAllPendingOOOUsersDbErrorShouldThrowException() {
|
||||
public void GetAllPendingOOOUsersDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.QueryAsync<OOOTemp>(It.IsAny<string>())).ThrowsAsync(new Exception("whoops!"));
|
||||
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
@ -113,7 +112,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task IsUserAlreadyOOOWithInvalidUserIdShouldThrowException() {
|
||||
public void IsUserAlreadyOOOWithInvalidUserIdShouldThrowException() {
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _userService.IsUserAlreadyOOO(0));
|
||||
@ -153,7 +152,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task IsDelegatorAlreadyDelegatedToDbErrorShouldThrowException() {
|
||||
public void IsDelegatorAlreadyDelegatedToDbErrorShouldThrowException() {
|
||||
_mockDalService.Setup(d => d.QueryAsync<User>(It.IsAny<string>())).ThrowsAsync(new Exception("whoops!"));
|
||||
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
@ -188,7 +187,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task InsertDelegatedRolesWithInvalidUserIdShouldThrowException() {
|
||||
public void InsertDelegatedRolesWithInvalidUserIdShouldThrowException() {
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _userService.InsertDelegatedRoles(0));
|
||||
@ -330,7 +329,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task FlagUserAsOOOWithNullOOOTempShouldThrowException() {
|
||||
public void FlagUserAsOOOWithNullOOOTempShouldThrowException() {
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentNullException>(async Task () => await _userService.FlagUserAsOOO(null));
|
||||
@ -373,7 +372,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RemoveOOOFlagForUserWithInvalidIdShouldThrowException() {
|
||||
public void RemoveOOOFlagForUserWithInvalidIdShouldThrowException() {
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentException>(async Task () => await _userService.RemoveOOOFlagForUser(0));
|
||||
@ -389,7 +388,7 @@ internal class UserServiceTests {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SetOOOTempProcessedWithNullOOOTempShouldThrowException() {
|
||||
public void SetOOOTempProcessedWithNullOOOTempShouldThrowException() {
|
||||
_userService = new UserService(MOCK_LOGGER, _mockDalService.Object);
|
||||
|
||||
Assert.ThrowsAsync<ArgumentNullException>(async Task () => await _userService.SetOOOTempProcessed(null));
|
||||
|
Reference in New Issue
Block a user