public IResult RemovePackSchedule(IRemovePackScheduleParameters parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } var packScheduleKeyResult = KeyParserHelper.ParseResult <IPackScheduleKey>(parameters.PackScheduleKey); if (!packScheduleKeyResult.Success) { return(packScheduleKeyResult.ConvertTo <DateTime?>()); } DateTime?packSchId; var result = new RemovePackScheduleConductor(_productionUnitOfWork).Execute(new PackScheduleKey(packScheduleKeyResult.ResultingObject), parameters.UserToken, out packSchId); if (!result.Success) { return(result.ConvertTo <DateTime?>()); } _productionUnitOfWork.Commit(); return(SyncParameters.Using(new SuccessResult(), packSchId)); }
public IResult <string> RemovePackSchedule(IRemovePackScheduleParameters parameters) { try { return(_productionServiceProvider.RemovePackSchedule(parameters).ConvertTo(parameters.PackScheduleKey)); } catch (Exception ex) { _exceptionLogger.LogException(ex); return(new FailureResult <string>(parameters.PackScheduleKey, ex.GetInnermostException().Message)); } }
public void UtilizesUserTokenProvider() { // arrange const string key = "1234"; IRemovePackScheduleParameters actualParameters = null; MockPackScheduleService.Setup(m => m.RemovePackSchedule(It.IsAny <IRemovePackScheduleParameters>())) .Callback((IRemovePackScheduleParameters p) => actualParameters = p) .Returns(new SuccessResult <string>()); // act SystemUnderTest.Delete(key); // assert Assert.IsNotNull(actualParameters); MockIdentityProvider.Verify(m => m.SetUserIdentity(actualParameters), Times.Once()); }
public void CallsServiceAsExpected() { // arrange const string key = "1234"; IRemovePackScheduleParameters actualParameters = null; MockPackScheduleService.Setup(m => m.RemovePackSchedule(It.IsAny <IRemovePackScheduleParameters>())) .Callback((IRemovePackScheduleParameters p) => actualParameters = p) .Returns(new SuccessResult <string>()); // act SystemUnderTest.Delete(key); // assert Assert.IsNotNull(actualParameters); MockPackScheduleService.Verify(m => m.RemovePackSchedule(It.IsAny <IRemovePackScheduleParameters>()), Times.Once()); Assert.AreEqual(actualParameters.PackScheduleKey, key); }