Exemple #1
0
        public void GetFancyFormAssociatedItems_WhenDataTableHasNoRows_ConfirmResult()
        {
            // Arrange
            var xmlData = CreateXmlData();

            _dataTableHasRows = false;

            ShimSPList.AllInstances.EnableThrottlingGet = _ => true;

            // Act
            var result = AssociatedListItemsClass.GetFancyFormAssociatedItems(xmlData, _web);

            // Assert
            this.ShouldSatisfyAllConditions(
                () => _reportingDBQueryExecutedCount.ShouldBe(1),
                () => result.ShouldContain("<table style='width:100%'><tr><td><table style='border-collapse: collapse;' class='fancy-col-table'>"),
                () => result.ShouldContain($"<td>{DummyString}</td>"),
                () => result.ShouldNotContain($"<a href='#' onclick=\"javascript:FancyDispFormClient.emptyFunction('');\">"),
                () => result.ShouldContain($"<div id='div_{ProjectListID}' class='listMainDiv'><span class='badge'>0</span>"),
                () => result.ShouldNotContain($"<div id='div_items_{ProjectListID}' class='slidingDiv'>"),
                () => result.ShouldNotContain($"<div class='fancy-display-form-wrapper slidingDivHeader'>{DummyString}</div>"),
                () => result.ShouldNotContain($"<a href='#' onclick=\"javascript:FancyDispFormClient.showNewForm('?LookupField=&LookupValue={DummyInt}');return false;\">"),
                () => result.ShouldNotContain($"<img title='Add new {DummyString}' alt='' src='/_layouts/epmlive/images/newitem5.png' class='ms-core-menu-buttonIcon'></img>"),
                () => result.ShouldNotContain($"<a href='#' alt='{DummyString}{DummyInt}_______________' title='{DummyString}{DummyInt}_______________'"),
                () => result.ShouldNotContain($"<a href='#' alt='{DummyString}' title='{DummyString}'"),
                () => result.ShouldNotContain($"onclick=\"javascript:FancyDispFormClient.showNewForm('?ID={DummyInt}&Source=http%3a%2f%2fxyz.com%2f');return false;\""),
                () => result.ShouldNotContain($"{DummyString}{DummyInt}_____________..."),
                () => result.ShouldNotContain($"<a data-itemid='{DummyInt}' data-listid='{ProjectListID}' data-webid='{WebID}' data-siteid='{SiteID}'></a>"));
        }
Exemple #2
0
        public void GetAssociatedItems_OnValidCall_ConfirmResult()
        {
            // Arrange
            var xmlData = CreateXmlData();

            // Act
            var result = AssociatedListItemsClass.GetAssociatedItems(xmlData);

            // Assert
            this.ShouldSatisfyAllConditions(
                () => _reportingDBQueryExecutedCount.ShouldBe(2),
                () => result.ShouldContain($"<div id='div_{ProjectListID}' class='listMainDiv'>"),
                () => result.ShouldContain($"<div id='div_items_{ProjectListID}' class='slidingDiv'>"),
                () => result.ShouldContain($"<div class='slidingDivHeader'>{DummyString}</div>"),
                () => result.ShouldContain($"<div class='slidingDivAdd'>"),
                () => result.ShouldContain($"<a href='#' onclick=\"javascript:showNewForm('?LookupField=Project&LookupValue=69490876-7284-4f10-9d1f-508230a8f76e');return false;\">"),
                () => result.ShouldContain($"<img title='Add new {DummyString}' alt='' src='/_layouts/epmlive/images/newitem5.png' class='ms-core-menu-buttonIcon'>"),
                () => result.ShouldContain($"onclick=\"javascript:showNewForm('?ID=1&Source=http%3a%2f%2fxyz.com%2f');return false;\""),
                () => result.ShouldContain($"{DummyString}{DummyInt}________..."),
                () => result.ShouldContain($"<li class='associateditemscontextmenu'>"),
                () => result.ShouldContain($"data-webid='{WebID}'"),
                () => result.ShouldContain($"data-siteid='{SiteID}'"),
                () => result.ShouldContain($"data-listid='{ProjectListID}'"),
                () => result.ShouldContain($"<div class='pipeSeperator'>|</div>"));
        }
Exemple #3
0
        public void GetFancyFormAssociatedItemAttachments_OnError_ReturnErrorMessage()
        {
            // Arrange
            var xmlData = CreateXmlData();

            ShimSPSite.ConstructorGuid = (_, __) =>
            {
                throw new APIException(DummyInt, DummyError);
            };

            // Act
            var result = AssociatedListItemsClass.GetFancyFormAssociatedItemAttachments(xmlData, _web);

            // Assert
            result.ShouldBe($"<Result Status=\"{DummyInt}\"><Error ID=\"{DummyInt}\">Error: {DummyError}</Error></Result>");
        }
Exemple #4
0
        public void GetFancyFormAssociatedItemAttachments_WhenHasNoAttachments_ConfirmResult()
        {
            // Arrange
            var xmlData = CreateXmlData();

            ShimSPListItem.AllInstances.AttachmentsGet = _ => new ShimSPAttachmentCollection();

            // Act
            var result = AssociatedListItemsClass.GetFancyFormAssociatedItemAttachments(xmlData, _web);

            // Assert
            this.ShouldSatisfyAllConditions(
                () => result.ShouldContain("<div id='attach-wrapper'>"),
                () => result.ShouldContain("<table class='fancy-col-table'><tr><td style='color:#bbbbbb;'>There are no attachments, click the \"+\" icon above to upload new attachments.</td></tr></table>"),
                () => result.ShouldNotContain("<div id='attach-text-wrapper'>"),
                () => result.ShouldNotContain("<div class='attach-text'>"),
                () => result.ShouldNotContain("<span class='icon-file'  style='margin-right:5px;color:#999999;'></span>"),
                () => result.ShouldNotContain($"<a href='{DummyUrl}/{DummyString}/attachments/{DummyInt}/{DummyString}' target='_blank' ID='{DummyString}' class='fancybox'>"),
                () => result.ShouldNotContain($"<span>{DummyString}</span>"),
                () => result.ShouldNotContain($"<a href='#' onclick=\"javascript:FancyDispFormClient.DeleteItemAttachment('"),
                () => result.ShouldNotContain($"{ DummyUrl}/_layouts/epmlive/gridaction.aspx?action=deleteitemattachment&listid={ProjectListID}&itemid={DummyInt}&fname={DummyString}"),
                () => result.ShouldNotContain($"<span class='fui-cross delete' style='top:2px;position:relative;'></span>"));
        }