Permalink
Browse files

Merged CSHARP-297 pull request from Brian Knight with minor tweak. Ad…

…ded additional unit test.
  • Loading branch information...
1 parent 23375b7 commit befe38a7100b1f9fcf355ce4a55c30ec1c25f382 rstam committed Aug 4, 2011
@@ -48,13 +48,6 @@ public class CollectionStatsResult : CommandResult {
}
/// <summary>
- /// Gets whether the collection is capped.
- /// </summary>
- public bool Capped {
- get { return response["capped", false].ToBoolean(); }
- }
-
- /// <summary>
/// Gets the data size.
/// </summary>
public long DataSize {
@@ -96,6 +89,13 @@ public class CollectionStatsResult : CommandResult {
}
/// <summary>
+ /// Gets whether the collection is capped.
+ /// </summary>
+ public bool IsCapped {
+ get { return response["capped", false].ToBoolean(); }
+ }
+
+ /// <summary>
/// Gets the last extent size.
/// </summary>
public long LastExtentSize {
@@ -1027,7 +1027,7 @@ MongoInsertOptions options
/// </summary>
/// <returns>True if this collection is capped.</returns>
public virtual bool IsCapped() {
- return GetStats().Capped;
+ return GetStats().IsCapped;
}
/// <summary>
@@ -715,8 +715,24 @@ private class Place {
}
[Test]
- public void TestIsCapped() {
- var capped = collection.IsCapped();
+ public void TestIsCappedFalse() {
+ var collection = database["notcappedcollection"];
+ collection.Drop();
+ database.CreateCollection("notcappedcollection");
+
+ Assert.AreEqual(true, collection.Exists());
+ Assert.AreEqual(false, collection.IsCapped());
+ }
+
+ [Test]
+ public void TestIsCappedTrue() {
+ var collection = database["cappedcollection"];
+ collection.Drop();
+ var options = CollectionOptions.SetCapped(true);
+ database.CreateCollection("cappedcollection", options);
+
+ Assert.AreEqual(true, collection.Exists());
+ Assert.AreEqual(true, collection.IsCapped());
}
#pragma warning disable 649 // never assigned to
View
@@ -27,6 +27,7 @@ see also: BreakingChanges.txt
* Teun Duynstee teun@duynstee.com
* Ken Egozi mail@kenegozi.com
* Simon Green simon@captaincodeman.com
+* Brian Knight brianknight10@gmail.com
* Richard Kreuter richard@10gen.com
* Kevin Lewis kevin.l.lewis@gmail.com
* Dow Liu redforks@gmail.com

0 comments on commit befe38a

Please sign in to comment.