public void RefreshResources_WhenErrorOnAddJob_ThrowException() { // Arrange ShimTimer.AddTimerJobGuidGuidStringInt32StringStringInt32Int32String = (_1, _2, _3, _4, _5, _6, _7, _8, _9) => { throw new Exception(DummyError); }; // Act Action action = () => ResourceGridClass.RefreshResources(_web); // Assert Should.Throw <APIException>(action).Message.ShouldBe(DummyError); }
public void RefreshResources_OnValidCall_ConfirmResult() { // Arrange var jobAdded = false; var jobEnqueued = false; ShimTimer.AddTimerJobGuidGuidStringInt32StringStringInt32Int32String = (_1, _2, _3, _4, _5, _6, _7, _8, _9) => { jobAdded = true; return(Guid.NewGuid()); }; ShimTimer.EnqueueGuidInt32SPSite = (_, __, ___) => jobEnqueued = true; // Act var result = ResourceGridClass.RefreshResources(_web); // Assert this.ShouldSatisfyAllConditions( () => jobAdded.ShouldBeTrue(), () => jobEnqueued.ShouldBeTrue(), () => result.ShouldNotBeNullOrEmpty(), () => result.ShouldBe(RefreshResourcesSucess)); }