5 changed files
D20Tek.Common | ||
D20Tek.Common.xml | ||
D20Tek.Common.Shared/DataTypes/Collections | ||
IPagedList.cs | ||
PagedListBase.cs | ||
D20Tek.Common.Standard | ||
D20Tek.Common.Standard.xml | ||
D20Tek.Common.UnitTests/DataTypes/Collections | ||
PagedListTests.cs | ||
Add comment 123 <member name="P:D20Tek.Common.Collections.PagedListBase`1.Item(System.Int32)">
Add comment 124 <inheritdoc/>
Add comment 125 </member>
Add comment 126 Plus <member name="M:D20Tek.Common.Collections.PagedListBase`1.CalculatePreviousPage">
Add comment 127 Plus <inheritdoc/>
Add comment 128 Plus </member>
Add comment 129 Plus <member name="M:D20Tek.Common.Collections.PagedListBase`1.CalculateNextPage">
Add comment 130 Plus <inheritdoc/>
Add comment 131 Plus </member>
Add comment 126 132 <member name="M:D20Tek.Common.Collections.PagedListBase`1.GetEnumerator">
Add comment 127 133 <inheritdoc/>
Add comment 128 134 </member>
Add comment 248 254 <param name="index">Index of element to get.</param>
Add comment 249 255 <returns>Element at specified index.</returns>
Add comment 250 256 </member>
Add comment 257 Plus <member name="M:D20Tek.Common.Collections.IPagedList`1.CalculatePreviousPage">
Add comment 258 Plus <summary>
Add comment 259 Plus Calculates the value of the previous page number from the current page.
Add comment 260 Plus </summary>
Add comment 261 Plus <returns>Previous page number.</returns>
Add comment 262 Plus </member>
Add comment 263 Plus <member name="M:D20Tek.Common.Collections.IPagedList`1.CalculateNextPage">
Add comment 264 Plus <summary>
Add comment 265 Plus Calculates the value of the next page number from the current page.
Add comment 266 Plus </summary>
Add comment 267 Plus <returns>Previous page number.</returns>
Add comment 268 Plus </member>
Add comment 251 269 <member name="T:D20Tek.Common.DataTypes.Collections.VirtualPagedList`1">
Add comment 252 270 <summary>
Add comment 253 271 Class that represents a list that has been separated into different pages.
IPagedList.cs
/D20Tek.Common.Shared/DataTypes/Collections/IPagedList.cs+12/D20Tek.Common.Shared/DataTypes/Collections/IPagedList.cs
Add comment 96 /// <param name="index">Index of element to get.</param>
Add comment 97 /// <returns>Element at specified index.</returns>
Add comment 98 T this[int index] { get; }
Add comment 99 Plus
Add comment 100 Plus /// <summary>
Add comment 101 Plus /// Calculates the value of the previous page number from the current page.
Add comment 102 Plus /// </summary>
Add comment 103 Plus /// <returns>Previous page number.</returns>
Add comment 104 Plus int CalculatePreviousPage();
Add comment 105 Plus
Add comment 106 Plus /// <summary>
Add comment 107 Plus /// Calculates the value of the next page number from the current page.
Add comment 108 Plus /// </summary>
Add comment 109 Plus /// <returns>Previous page number.</returns>
Add comment 110 Plus int CalculateNextPage();
Add comment 99 111 }
Add comment 100 112 }
Add comment 101 113
PagedListBase.cs
/D20Tek.Common.Shared/DataTypes/Collections/PagedListBase.cs+14/D20Tek.Common.Shared/DataTypes/Collections/PagedListBase.cs
Add comment 21 /// <typeparam name="T">Type of element in the list.</typeparam>
Add comment 22 public abstract class PagedListBase<T> : IPagedList<T>
Add comment 23 {
Add comment 24 Plus private const int DefaultStartingPage = 1;
Add comment 25 Plus
Add comment 24 26 /// <summary>
Add comment 25 27 /// Initializes a new instance of the <see cref="PagedListBase{T}"/> class.
Add comment 26 28 /// </summary>
Add comment 159 161 public T this[int index] => this.PagedView[index];
Add comment 160 162
Add comment 161 163 /// <inheritdoc/>
Add comment 164 Plus public int CalculatePreviousPage()
Add comment 165 Plus {
Add comment 166 Plus return Math.Max(this.PageNumber - 1, DefaultStartingPage);
Add comment 167 Plus }
Add comment 168 Plus
Add comment 169 Plus /// <inheritdoc/>
Add comment 170 Plus public int CalculateNextPage()
Add comment 171 Plus {
Add comment 172 Plus return Math.Min(this.PageNumber + 1, this.PageCount);
Add comment 173 Plus }
Add comment 174 Plus
Add comment 175 Plus /// <inheritdoc/>
Add comment 162 176 public IEnumerator<T> GetEnumerator()
Add comment 163 177 {
Add comment 164 178 return this.PagedView.GetEnumerator();
D20Tek.Common.Standard.xml
/D20Tek.Common.Standard/D20Tek.Common.Standard.xml+18/D20Tek.Common.Standard/D20Tek.Common.Standard.xml
Add comment 108 <member name="P:D20Tek.Common.Collections.PagedListBase`1.Item(System.Int32)">
Add comment 109 <inheritdoc/>
Add comment 110 </member>
Add comment 111 Plus <member name="M:D20Tek.Common.Collections.PagedListBase`1.CalculatePreviousPage">
Add comment 112 Plus <inheritdoc/>
Add comment 113 Plus </member>
Add comment 114 Plus <member name="M:D20Tek.Common.Collections.PagedListBase`1.CalculateNextPage">
Add comment 115 Plus <inheritdoc/>
Add comment 116 Plus </member>
Add comment 111 117 <member name="M:D20Tek.Common.Collections.PagedListBase`1.GetEnumerator">
Add comment 112 118 <inheritdoc/>
Add comment 113 119 </member>
Add comment 233 239 <param name="index">Index of element to get.</param>
Add comment 234 240 <returns>Element at specified index.</returns>
Add comment 235 241 </member>
Add comment 242 Plus <member name="M:D20Tek.Common.Collections.IPagedList`1.CalculatePreviousPage">
Add comment 243 Plus <summary>
Add comment 244 Plus Calculates the value of the previous page number from the current page.
Add comment 245 Plus </summary>
Add comment 246 Plus <returns>Previous page number.</returns>
Add comment 247 Plus </member>
Add comment 248 Plus <member name="M:D20Tek.Common.Collections.IPagedList`1.CalculateNextPage">
Add comment 249 Plus <summary>
Add comment 250 Plus Calculates the value of the next page number from the current page.
Add comment 251 Plus </summary>
Add comment 252 Plus <returns>Previous page number.</returns>
Add comment 253 Plus </member>
Add comment 236 254 <member name="T:D20Tek.Common.DataTypes.Collections.VirtualPagedList`1">
Add comment 237 255 <summary>
Add comment 238 256 Class that represents a list that has been separated into different pages.
PagedListTests.cs
/D20Tek.Common.UnitTests/DataTypes/Collections/PagedListTests.cs+72/D20Tek.Common.UnitTests/DataTypes/Collections/PagedListTests.cs
Add comment 208 Assert.AreEqual(5, list.Count);
Add comment 209 Assert.IsNotNull(list.GetEnumerator());
Add comment 210 }
Add comment 211 Plus
Add comment 212 Plus [TestMethod]
Add comment 213 Plus public void CalculatePreviousPage_AtOtherPage()
Add comment 214 Plus {
Add comment 215 Plus // setup
Add comment 216 Plus var full = new List<int> { 4, 8, 2, 20, 12, 6, 10, 100, 3 };
Add comment 217 Plus var list = new PagedList<int>(full, 2, 5);
Add comment 218 Plus
Add comment 219 Plus // test
Add comment 220 Plus var prev = list.CalculatePreviousPage();
Add comment 221 Plus
Add comment 222 Plus // validate
Add comment 223 Plus Assert.IsNotNull(list);
Add comment 224 Plus Assert.AreEqual(2, list.PageNumber);
Add comment 225 Plus Assert.IsTrue(list.HasPreviousPage);
Add comment 226 Plus Assert.IsFalse(list.HasNextPage);
Add comment 227 Plus Assert.AreEqual(1, prev);
Add comment 228 Plus }
Add comment 229 Plus
Add comment 230 Plus [TestMethod]
Add comment 231 Plus public void CalculatePreviousPage_AtFirstPage()
Add comment 232 Plus {
Add comment 233 Plus // setup
Add comment 234 Plus var full = new List<int> { 4, 8, 2, 20, 12, 6, 10, 100, 3 };
Add comment 235 Plus var list = new PagedList<int>(full, 1, 5);
Add comment 236 Plus
Add comment 237 Plus // test
Add comment 238 Plus var prev = list.CalculatePreviousPage();
Add comment 239 Plus
Add comment 240 Plus // validate
Add comment 241 Plus Assert.IsNotNull(list);
Add comment 242 Plus Assert.AreEqual(1, list.PageNumber);
Add comment 243 Plus Assert.IsFalse(list.HasPreviousPage);
Add comment 244 Plus Assert.IsTrue(list.HasNextPage);
Add comment 245 Plus Assert.AreEqual(1, prev);
Add comment 246 Plus }
Add comment 247 Plus
Add comment 248 Plus [TestMethod]
Add comment 249 Plus public void CalculateNextPage_AtLastPage()
Add comment 250 Plus {
Add comment 251 Plus // setup
Add comment 252 Plus var full = new List<int> { 4, 8, 2, 20, 12, 6, 10, 100, 3 };
Add comment 253 Plus var list = new PagedList<int>(full, 2, 5);
Add comment 254 Plus
Add comment 255 Plus // test
Add comment 256 Plus var next = list.CalculateNextPage();
Add comment 257 Plus
Add comment 258 Plus // validate
Add comment 259 Plus Assert.IsNotNull(list);
Add comment 260 Plus Assert.AreEqual(2, list.PageNumber);
Add comment 261 Plus Assert.IsTrue(list.HasPreviousPage);
Add comment 262 Plus Assert.IsFalse(list.HasNextPage);
Add comment 263 Plus Assert.AreEqual(2, next);
Add comment 264 Plus }
Add comment 265 Plus
Add comment 266 Plus [TestMethod]
Add comment 267 Plus public void CalculateNextPage_AtOtherPage()
Add comment 268 Plus {
Add comment 269 Plus // setup
Add comment 270 Plus var full = new List<int> { 4, 8, 2, 20, 12, 6, 10, 100, 3 };
Add comment 271 Plus var list = new PagedList<int>(full, 1, 5);
Add comment 272 Plus
Add comment 273 Plus // test
Add comment 274 Plus var next = list.CalculateNextPage();
Add comment 275 Plus
Add comment 276 Plus // validate
Add comment 277 Plus Assert.IsNotNull(list);
Add comment 278 Plus Assert.AreEqual(1, list.PageNumber);
Add comment 279 Plus Assert.IsFalse(list.HasPreviousPage);
Add comment 280 Plus Assert.IsTrue(list.HasNextPage);
Add comment 281 Plus Assert.AreEqual(2, next);
Add comment 282 Plus }
Add comment 211 283 }
Add comment 212 284 }
Add comment 213 285