Esempio n. 1
0
        public void Commit_test()
        {
            // arrange
            storage[0] = new Dictionary<string, object>
            {
                {"List", new List<int> {1,2,3 } }
            };
            var list = new LazyList<int>(dbCollectionMock.Object, 0, "List");

            // act
            list[0] = 69;
            list[1] = 69;
            list[2] = 69;
            list.Commit();

            // assert
            var storageList = ((storage[0]["List"]) as IEnumerable<int>);
            storageList.ElementAt(0).Should().Be(69);
            storageList.ElementAt(1).Should().Be(69);
            storageList.ElementAt(2).Should().Be(69);

            dbCollectionMock.Verify(x => x.ArrayElem(0, "List", It.IsAny<int>()), Times.Never);
        }