public void InsertItem_TypedUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var result = store.InsertItem("myUser2", new User {
                Id = 12, Name = "Teddy"
            });

            Assert.True(result);

            var user = store.GetItem <User>("myUser2");

            Assert.Equal("Teddy", user.Name);

            var store2 = new DataStore(newFilePath);

            var user2 = store2.GetItem <User>("myUser2");

            Assert.Equal("Teddy", user2.Name);

            var userDyanmic = store2.GetItem("myUser2");

            Assert.Equal("Teddy", userDyanmic.name);

            UTHelpers.Down(newFilePath);
        }
        public async Task UpdateItem_DynamicUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var result = await store.InsertItemAsync("myUser2", new { id = 12, name = "Teddy", Value = 2.1 });

            Assert.True(result);

            var user = store.GetItem("myUser2");

            Assert.Equal("Teddy", user.name);
            Assert.Equal(2.1, user.value);

            var updateResult = await store.UpdateItemAsync("myUser2", new { name = "Harold" });

            var store2 = new DataStore(newFilePath);

            var user2 = store2.GetItem("myUser2");

            Assert.Equal("Harold", user2.name);

            UTHelpers.Down(newFilePath);
        }
        public void FullTextSearch_Typed()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>();
            var matches    = collection.Find("Box");

            Assert.Equal(1, matches.Count());

            var collection2 = store.GetCollection <Family>();

            var matches2 = collection2.Find("Hillsboro");

            Assert.Equal(5, matches2.Count());

            var matches21 = collection2.Find("hillsboro", true);

            Assert.Equal(0, matches21.Count());

            var matches3 = collection2.Find("44").ToList();

            Assert.Equal(9, matches3.Count());

            UTHelpers.Down(newFilePath);
        }
        public void InsertItem_TypedUserSecure()
        {
            var newFilePath = UTHelpers.Up(encryptionKey: EncryptionPassword);

            var store = new DataStore(path: newFilePath, encryptionKey: EncryptionPassword);

            var result = store.InsertItem("myUser2", new User {
                Id = 12, Name = "Teddy"
            });

            Assert.True(result);

            var user = store.GetItem <User>("myUser2");

            Assert.Equal("Teddy", user.Name);

            var store2 = new DataStore(path: newFilePath, encryptionKey: EncryptionPassword);

            var user2 = store2.GetItem <User>("myUser2");

            Assert.Equal("Teddy", user2.Name);

            var userDynamic = store2.GetItem("myUser2");

            Assert.Equal("Teddy", userDynamic.name);

            UTHelpers.Down(newFilePath);
        }
Ejemplo n.º 5
0
        public async Task ReplaceOne_Upsert_Custom_Id_Dynamic()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath, keyProperty: "CustomId");

            var collection = store.GetCollection("questions");

            var item = new
            {
                CustomId = "54ccb8f2-5f2c-4cfa-b525-f0871eca787c",
                Name     = "First_Tester"
            };

            var itemTwo = new
            {
                CustomId = "ee314079-7d18-405b-9bb7-9248c672b3f5",
                Name     = "Second_Tester"
            };

            var success = await collection.ReplaceOneAsync(item.CustomId, item, true);

            Assert.True(success);

            success = await collection.ReplaceOneAsync(itemTwo.CustomId, itemTwo, true);

            Assert.True(success);

            var fromDb = collection.AsQueryable().SingleOrDefault(e => e.CustomId == itemTwo.CustomId);

            Assert.NotNull(fromDb);
            Assert.Equal("Second_Tester", fromDb.Name);

            UTHelpers.Down(newFilePath);
        }
        public async Task UpdateItem_ValueType()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var result = await store.InsertItemAsync("counter", 2);

            Assert.True(result);

            var counter = store.GetItem <int>("counter");

            Assert.Equal(2, counter);

            var updateResult = await store.UpdateItemAsync("counter", "2");

            Assert.True(result);

            var store2 = new DataStore(newFilePath);

            var c2 = store2.GetItem("counter");

            Assert.Equal("2", c2);

            UTHelpers.Down(newFilePath);
        }
        public void GetNextIdValue_StringType_JToken()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath, keyProperty: "myId");

            var collection = store.GetCollection("collectionWithStringId");

            // Insert seed value with upsert
            collection.ReplaceOne(e => e, JToken.Parse("{ 'myId': 'test1' }"), true);

            var nextId = collection.GetNextIdValue();

            Assert.Equal("test2", nextId);

            var nextUpdate = JToken.Parse("{ 'myId': 'somethingWrong2' }");

            collection.InsertOne(nextUpdate);
            Assert.Equal(nextId, nextUpdate["myId"]);

            nextId = collection.GetNextIdValue();
            Assert.Equal("test3", nextId);

            nextUpdate = JToken.Parse("{ 'xxx': 111 }");
            collection.InsertOne(nextUpdate);
            Assert.Equal(nextId, nextUpdate["myId"]);
            Assert.Equal(111, nextUpdate["xxx"]);

            nextId = collection.GetNextIdValue();
            Assert.Equal("test4", nextId);
        }
Ejemplo n.º 8
0
        public async Task WriteToFile_LowerCamelCase()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <PrivateOwner>("PrivateOwner");

            Assert.Equal(0, collection.Count);

            await collection.InsertOneAsync(new PrivateOwner { FirstName = "Jimmy", OwnerLongTestProperty = "UT" });

            Assert.Equal(1, collection.Count);

            var json = File.ReadAllText(newFilePath);

            Assert.Contains("privateOwner", json);
            Assert.Contains("ownerLongTestProperty", json);

            var store2 = new DataStore(newFilePath);

            var collectionUppercase = store2.GetCollection <PrivateOwner>("PrivateOwner");

            Assert.Equal(0, collectionUppercase.Count);

            var collectionLowercase = store2.GetCollection <PrivateOwner>("privateOwner");

            Assert.Equal(1, collectionLowercase.Count);

            var collectionNoCase = store2.GetCollection <PrivateOwner>();

            Assert.Equal(1, collectionNoCase.Count);

            UTHelpers.Down(newFilePath);
        }
        public void ReloadAutiomatic()
        {
            var newFilePath = UTHelpers.Up();

            var store  = new DataStore(newFilePath);
            var store2 = new DataStore(newFilePath, reloadBeforeGetCollection: true);

            var collection1_1 = store.GetCollection("user");
            var collection2_1 = store2.GetCollection("user");

            Assert.Equal(3, collection1_1.Count);
            Assert.Equal(3, collection2_1.Count);

            collection1_1.InsertOne(new { id = 16, name = "Teddy" });
            Assert.Equal(4, collection1_1.Count);
            Assert.Equal(3, collection2_1.Count);

            var collection1_2 = store.GetCollection("user");
            var collection2_2 = store2.GetCollection("user");

            Assert.Equal(4, collection1_2.Count);
            Assert.Equal(4, collection2_2.Count);

            UTHelpers.Down(newFilePath);
        }
        public void FullTextSearch_Dynamic()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection("user");
            var matches    = collection.Find("Box");

            Assert.Single(matches);

            var collection2 = store.GetCollection("family");

            var matches2 = collection2.Find("Hillsboro");

            Assert.Equal(5, matches2.Count());

            var matches21 = collection2.Find("hillsboro", true);

            Assert.Empty(matches21);

            var matches3 = collection2.Find("44");

            Assert.Equal(9, matches3.Count());

            UTHelpers.Down(newFilePath);
        }
        public async Task InsertOne_100Async()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("user");

            Assert.Equal(3, collection.Count);

            var tasks = Enumerable.Range(0, 100)
                        .AsParallel()
                        .Select(i => collection.InsertOneAsync(new User {
                Id = i, Name = $"Teddy_{i}"
            }))
                        .ToList();

            await Task.WhenAll(tasks);

            var store2      = new DataStore(newFilePath);
            var collection2 = store2.GetCollection <User>("user");

            Assert.Equal(103, collection2.Count);

            var distinct = collection2.AsQueryable().GroupBy(e => e.Id).Select(g => g.First());

            Assert.Equal(103, distinct.Count());

            var distinct2 = collection2.AsQueryable().GroupBy(e => e.Name).Select(g => g.First());

            Assert.Equal(103, distinct2.Count());

            UTHelpers.Down(newFilePath);
        }
        public async Task InsertOne_100SyncThreaded()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collectionPreCheck = store.GetCollection <User>("user");

            Assert.Equal(3, collectionPreCheck.Count);

            var tasks = Enumerable.Range(0, 2).Select(cId =>
            {
                return(Task.Run(() =>
                {
                    var collection = store.GetCollection <User>($"user_{cId}");

                    for (int i = 0; i < 50; i++)
                    {
                        collection.InsertOne(new User {
                            Id = i, Name = $"Teddy_{i}"
                        });
                    }

                    return true;
                }));
            });

            await Task.WhenAll(tasks);

            var store2      = new DataStore(newFilePath);
            var collection2 = store2.GetCollection <User>("user");

            Assert.Equal(3, collection2.Count);

            var collection_0 = store2.GetCollection <User>("user_0");

            Assert.Equal(50, collection_0.Count);

            var distinct_0a = collection_0.AsQueryable().GroupBy(e => e.Id).Select(g => g.First());

            Assert.Equal(50, distinct_0a.Count());

            var distinct_0b = collection_0.AsQueryable().GroupBy(e => e.Name).Select(g => g.First());

            Assert.Equal(50, distinct_0b.Count());

            var collection_1 = store2.GetCollection <User>("user_1");

            Assert.Equal(50, collection_1.Count);

            var distinct_1a = collection_1.AsQueryable().GroupBy(e => e.Id).Select(g => g.First());

            Assert.Equal(50, distinct_1a.Count());

            var distinct_1b = collection_1.AsQueryable().GroupBy(e => e.Name).Select(g => g.First());

            Assert.Equal(50, distinct_1b.Count());

            UTHelpers.Down(newFilePath);
        }
        public void UpdateOne_InnerCollection_FromAndToNull_Dynamic()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection("family");

            var family = collection
                         .Find(p => p.id == 4)
                         .First();

            Assert.Null(family.children[1].friends);

            var origCount = family.children[0].friends.Count;

            family.children[1].friends = ((List <dynamic>)family.children[0].friends).ToList();
            family.children[0].friends = null;

            collection.UpdateOne(family.id, family);

            var store2 = new DataStore(newFilePath);

            var collection2 = store2.GetCollection <Family>();

            var family_updated = collection2
                                 .Find(p => p.Id == 4)
                                 .First();

            Assert.Equal(origCount, family_updated.Children[1].Friends.Count);
            Assert.Null(family_updated.Children[0].Friends);

            UTHelpers.Down(newFilePath);
        }
Ejemplo n.º 14
0
        public async Task UpdateInnerFloatArray_TypedWorld()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <World>("worlds");

            Assert.Equal(1, collection.Count);

            var original = collection.Find(e => e.Id == 0).First();

            Assert.InRange(original.Position[0], 3.66, 3.67);

            await collection.UpdateOneAsync(e => e.Id == 0, new { CameraRotationX = 5.2f });

            var collection2 = store.GetCollection <World>("worlds");
            var updated     = collection2.Find(e => e.Id == 0).First();

            Assert.InRange(updated.CameraRotationX, 5.19, 5.2);

            await collection.UpdateOneAsync(e => e.Id == 0, new { Position = new float[] { 10, 11, 12 } });

            var collection3 = store.GetCollection <World>("worlds");
            var updated2    = collection3.Find(e => e.Id == 0).First();

            Assert.Equal(10, updated2.Position[0]);
            Assert.Equal(11, updated2.Position[1]);
            Assert.Equal(12, updated2.Position[2]);

            UTHelpers.Down(newFilePath);
        }
        public async Task InsertOneAsync_TypedUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("user");

            Assert.Equal(3, collection.Count);

            await collection.InsertOneAsync(new User { Id = 24, Name = "Teddy" });

            Assert.Equal(4, collection.Count);

            var collection2 = store.GetCollection("user");

            Assert.Equal(4, collection2.Count);

            var store2 = new DataStore(newFilePath);

            var collection3 = store2.GetCollection("user");

            Assert.Equal(4, collection3.Count);

            UTHelpers.Down(newFilePath);
        }
Ejemplo n.º 16
0
        public async Task UpdateInnerFloatArray_DynamicWorld()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection("worlds");

            Assert.Equal(1, collection.Count);

            var original = collection.Find(e => e.id == 0).First();

            Assert.Equal(3.6640577, original.position[0]);

            await collection.UpdateOneAsync(e => e.id == 0, new { cameraRotationX = 5.2 });

            var collection2 = store.GetCollection("worlds");
            var updated     = collection2.Find(e => e.id == 0).First();

            Assert.Equal(5.2, updated.cameraRotationX);

            await collection.UpdateOneAsync(e => e.id == 0, new { position = new float[] { 10, 11, 12 } });

            var collection3 = store.GetCollection("worlds");
            var updated2    = collection3.Find(e => e.id == 0).First();

            Assert.Equal(10, updated2.position[0]);
            Assert.Equal(11, updated2.position[1]);
            Assert.Equal(12, updated2.position[2]);

            UTHelpers.Down(newFilePath);
        }
        public async Task DeleteOneAsync_DynamicNewCollection()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath, false);

            var collection = store.GetCollection("book");

            Assert.Equal(0, collection.Count);

            await collection.InsertOneAsync(new { Id = 1, Name = "Some name" });

            Assert.Equal(1, collection.Count);

            var store2 = new DataStore(newFilePath);

            var collection2 = store2.GetCollection("book");

            Assert.Equal(1, collection2.Count);

            var deleteResult = await collection2.DeleteOneAsync(e => e.Id == 1);

            Assert.True(deleteResult);
            Assert.Equal(0, collection2.Count);

            var store3      = new DataStore(newFilePath);
            var collection3 = store3.GetCollection("book");

            Assert.Equal(0, collection3.Count);

            UTHelpers.Down(newFilePath);
        }
Ejemplo n.º 18
0
        public async Task Readme_Example3()
        {
            var pathToJson = UTHelpers.Up();

            // Open database (create new if file doesn't exist)
            var store = new DataStore(pathToJson);

            // Get employee collection
            var collection = store.GetCollection <Employee>();

            // Create new employee instance
            var employee = new Employee
            {
                Name = "John",
                Age  = 46
            };

            // Get next id value
            employee.Id = collection.GetNextIdValue();

            // Insert new employee
            await collection.InsertOneAsync(employee);

            // Update user
            employee.Name = "John Doe";

            await collection.UpdateOneAsync(e => e.Id == employee.Id, employee);

            // Use LINQ to query items
            var results = collection.AsQueryable().Where(e => e.Age > 30);

            Assert.Single(results.Where(e => e.Name == "John Doe"));

            UTHelpers.Down(pathToJson);
        }
        public void ReplaceOne_Upsert_DynamicUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection("user");

            Assert.Equal(3, collection.Count);

            var success = collection.ReplaceOne(e => e.id == 11, new { id = 11, name = "Theodor" });

            Assert.False(success);

            success = collection.ReplaceOne(e => e.id == 11, new { id = 11, name = "Theodor" }, true);
            Assert.True(success);
            Assert.Equal(4, collection.Count);

            success = collection.ReplaceOne(e => e.id == 11, new { id = 11, name = "Jimmy" }, true);
            Assert.True(success);
            Assert.Equal(4, collection.Count);

            var fromDb = collection.AsQueryable().SingleOrDefault(e => e.id == 11);

            Assert.NotNull(fromDb);
            Assert.Equal("Jimmy", fromDb.name);

            UTHelpers.Down(newFilePath);
        }
        public void DeleteOne_TypedUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("user");

            Assert.Equal(3, collection.Count);

            var newUser = new User {
                Id = 11, Name = "Teddy"
            };

            collection.InsertOne(newUser);
            Assert.Equal(4, collection.Count);

            var store2 = new DataStore(newFilePath);

            var collection2 = store2.GetCollection <User>("user");

            collection2.DeleteOne(e => e.Id == newUser.Id);
            Assert.Equal(3, collection2.Count);

            var store3      = new DataStore(newFilePath);
            var collection3 = store3.GetCollection <User>("user");

            Assert.Equal(3, collection3.Count);

            UTHelpers.Down(newFilePath);
        }
        public void GetNextIdValue_StringType()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath, keyProperty: "helloField");

            var collection = store.GetCollection("collectionWithStringId");

            var shouldBeNone = collection.GetNextIdValue();

            Assert.Equal(0, shouldBeNone);

            collection.InsertOne(new { helloField = "SomeValue" });

            var inserted = collection.AsQueryable().First();

            var nextId = collection.GetNextIdValue();

            Assert.Equal("SomeValue0", nextId);

            collection.InsertOne(new { helloField = nextId });

            nextId = collection.GetNextIdValue();
            Assert.Equal("SomeValue1", nextId);
        }
        public void ReplaceOne_TypedUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("user");

            Assert.Equal(3, collection.Count);

            var newUser = new User {
                Id = 11, Name = "Teddy"
            };

            collection.InsertOne(newUser);
            Assert.Equal(4, collection.Count);

            var store2 = new DataStore(newFilePath);

            var collection2 = store2.GetCollection <User>("user");

            Assert.Equal(4, collection2.Count);

            collection2.ReplaceOne(e => e.Id == newUser.Id, new User {
                Id = newUser.Id, Name = "Theodor"
            });

            var store3      = new DataStore(newFilePath);
            var collection3 = store3.GetCollection <User>("user");
            var updated     = collection3.Find(e => e.Id == newUser.Id).First();

            Assert.Equal("Theodor", updated.Name);

            UTHelpers.Down(newFilePath);
        }
        public async Task UpdateOneAsync_TypedUser_WrongCase()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("users2");

            await collection.InsertOneAsync(new User { Id = 0, Name = "original" });

            await collection.InsertOneAsync(new User { Id = 1, Name = "original 2" });

            var store2 = new DataStore(newFilePath);

            var collection2 = store2.GetCollection <User>("users2");
            await collection2.UpdateOneAsync(x => x.Id == 0, new { name = "new value" });

            await collection2.UpdateOneAsync(x => x.Id == 1, JToken.Parse("{ name: \"new value 2\"} "));

            var store3 = new DataStore(newFilePath);

            var collection3 = store3.GetCollection <User>("users2");
            var items       = collection3.AsQueryable();

            Assert.Equal(2, items.Count());

            Assert.Equal("new value", items.First().Name);
            Assert.Equal("new value 2", items.Last().Name);
        }
        public async Task UpdateOne_DynamicUser_WrongCase()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection("user");

            Assert.Equal(3, collection.Count);

            await collection.InsertOneAsync(new { id = 11, name = "Teddy", age = 21 });

            dynamic source = new ExpandoObject();

            source.Age = 22;
            var updateResult = await collection.UpdateOneAsync(e => e.id == 11, source as object);

            Assert.True(updateResult);

            var store2      = new DataStore(newFilePath);
            var collection2 = store2.GetCollection("user");
            var updated     = collection2.Find(e => e.id == 11).First();

            Assert.Equal(22, updated.age);
            Assert.Equal("Teddy", updated.name);

            UTHelpers.Down(newFilePath);
        }
        public void DeleteItem_DynamicUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath, reloadBeforeGetCollection: true);

            var user = store.GetItem("myUser2");

            Assert.Null(user);

            var result = store.InsertItem("myUser2", new { id = 12, name = "Teddy" });

            Assert.True(result);

            user = store.GetItem("myUser2");
            Assert.Equal("Teddy", user.name);

            var store2 = new DataStore(newFilePath);

            var deleteResult = store2.DeleteItem("myUser2");

            Assert.True(deleteResult);

            var user2 = store2.GetItem("myUser2");

            Assert.Null(user2);

            user = store.GetItem("myUser2");
            Assert.Null(user);

            UTHelpers.Down(newFilePath);
        }
        public void InsertOne_TypedUser_NewUser_WithId()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("user2");

            Assert.Equal(0, collection.Count);

            collection.InsertOne(new User {
                Id = 12, Name = "Teddy"
            });
            Assert.Equal(1, collection.Count);

            var collection2 = store.GetCollection <User>("user2");

            Assert.Equal(1, collection2.Count);

            var store2 = new DataStore(newFilePath);

            var collection3 = store2.GetCollection <User>("user2");

            Assert.Equal(1, collection3.Count);

            var item = collection3.AsQueryable().SingleOrDefault(e => e.Id == 12);

            Assert.NotNull(item);

            UTHelpers.Down(newFilePath);
        }
        public void InsertOne_DynamicUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection("user");

            Assert.Equal(3, collection.Count);

            collection.InsertOne(new { id = 16, name = "Teddy" });
            Assert.Equal(4, collection.Count);

            var collection2 = store.GetCollection("user");

            Assert.Equal(4, collection2.Count);

            var store2 = new DataStore(newFilePath);

            var collection3 = store2.GetCollection("user");

            Assert.Equal(4, collection3.Count);

            UTHelpers.Down(newFilePath);
        }
        public void GetNextIdValue_TypedUser()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <User>("user");
            var nextId     = collection.GetNextIdValue();

            Assert.Equal(4, nextId);
        }
        public async Task ReplaceItem_DynamicUser_NotFound()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var result = await store.ReplaceItemAsync("myUser2", new { id = 2, name = "James" });

            Assert.False(result);

            UTHelpers.Down(newFilePath);
        }
        public async Task UpdateOne_TypedModel_InnerSimpleIntArray()
        {
            var newFilePath = UTHelpers.Up();

            var store = new DataStore(newFilePath);

            var collection = store.GetCollection <TestModelWithIntArray>();

            Assert.Equal(0, collection.Count);

            var newModel = new TestModelWithIntArray
            {
                Id        = Guid.NewGuid().ToString(),
                Type      = "empty",
                Fragments = new List <int>
                {
                    1
                }
            };

            var insertResult = collection.InsertOne(newModel);

            Assert.True(insertResult);
            Assert.Equal(1, collection.Count);

            var store2      = new DataStore(newFilePath);
            var collection2 = store2.GetCollection <TestModelWithIntArray>();

            Assert.Equal(1, collection2.Count);

            var updateData = new
            {
                Type      = "filled",
                Fragments = new List <int>
                {
                    2,
                    3
                }
            };

            await collection2.UpdateOneAsync(e => e.Id == newModel.Id, updateData);

            var store3      = new DataStore(newFilePath);
            var collection3 = store3.GetCollection <TestModelWithIntArray>();
            var updated     = collection3.Find(e => e.Id == newModel.Id).First();

            Assert.Equal(2, updated.Fragments.Count());
            Assert.Equal(2, updated.Fragments.First());
            Assert.Equal(3, updated.Fragments.Last());
            Assert.Equal("filled", updated.Type);

            UTHelpers.Down(newFilePath);
        }