コード例 #1
0
        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));
        }
コード例 #2
0
        public void DeleteResourcePoolResource_OnValidCall_ConfirmResult()
        {
            // Arrange
            var xmlString = CreateXMLString();

            // Act
            var result = ResourceGridClass.DeleteResourcePoolResource(xmlString);

            // Assert
            this.ShouldSatisfyAllConditions(
                () => _itemDeleted.ShouldBeTrue(),
                () => result.ShouldContain(DeleteResourcePoolResourceTag));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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."));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }