public void DeleteResourcePoolResource_WhenRootIsNull_ThrowException() { // Arrange, Act Action action = () => ResourceGridClass.DeleteResourcePoolResource(string.Empty); // Assert var exception = Should.Throw <APIException>(action); this.ShouldSatisfyAllConditions( () => exception.ShouldNotBeNull(), () => exception.Message.ShouldContain(RootElementIsMissing)); }
public void DeleteResourcePoolResource_OnValidCall_ConfirmResult() { // Arrange var xmlString = CreateXMLString(); // Act var result = ResourceGridClass.DeleteResourcePoolResource(xmlString); // Assert this.ShouldSatisfyAllConditions( () => _itemDeleted.ShouldBeTrue(), () => result.ShouldContain(DeleteResourcePoolResourceTag)); }
public void DeleteResourcePoolResource_WhenInvalidId_ThrowException() { // Arrange var xmlString = $"<Root><Resource Id='{DummyString}'/></Root>"; // Act Action action = () => ResourceGridClass.DeleteResourcePoolResource(xmlString); // Assert var exception = Should.Throw <APIException>(action); this.ShouldSatisfyAllConditions( () => exception.ShouldNotBeNull(), () => exception.Message.ShouldContain(NotValidResourcePoolId)); }
public void DeleteResourcePoolResource_WhenNoId_ThrowException() { // Arrange var xmlString = "<Root><Resource /></Root>"; // Act Action action = () => ResourceGridClass.DeleteResourcePoolResource(xmlString); // Assert var exception = Should.Throw <APIException>(action); this.ShouldSatisfyAllConditions( () => exception.ShouldNotBeNull(), () => exception.Message.ShouldContain(@"Cannot find the DeleteResourcePoolResource\Resource Id attribute.")); }
public void DeleteResourcePoolResource_WhenResourceDoesNotExist_ThrowException() { // Arrange var xmlString = CreateXMLString(); ShimSPListItemManager.AllInstances.ItemExistsInt32 = (_, __) => false; // Act Action action = () => ResourceGridClass.DeleteResourcePoolResource(xmlString); // Assert var exception = Should.Throw <APIException>(action); this.ShouldSatisfyAllConditions( () => exception.ShouldNotBeNull(), () => exception.Message.ShouldContain(NotValidResourcePoolId)); }
public void DeleteResourcePoolResource_WhenPerformDeleteReturnsValue_ConfirmResult() { // Arrange var xmlString = CreateXMLString(); ShimManagementUtilities.PerformDeleteResourceCheckInt32GuidSPWebStringOutStringOut = (int _1, Guid _2, SPWeb _3, out string _4, out string _5) => { _4 = NoValueString; _5 = DummyError; return(false); }; // Act var result = ResourceGridClass.DeleteResourcePoolResource(xmlString); // Assert this.ShouldSatisfyAllConditions( () => result.ShouldNotBeNullOrEmpty(), () => result.ShouldContain(DeleteResourcePoolResourceTag), () => result.ShouldContain(DummyError)); }