public async Task Json_NewItemsSave_Then_ReadBack()
        {
            //Arrange
            var list = new List <ContentItem> {
                new ContentItem {
                    Name = "A", Value = "ValA", Enabled = true
                },
                new ContentItem {
                    Name             = "B",
                    Value            = "ValB",
                    Enabled          = true,
                    EnabledStartDate = new DateTime(2020, 1, 1),
                    EnabledEndDate   = new DateTime(2020, 1, 31)
                }
            };

            var store = new JsonFileContentSource(_location);

            //Act
            await store.SaveAllContentItemsAsync("en-US", list);

            var check = (await store.GetAllContentItemsAsync("en-Us", null)).ToArray();

            //Assert
            for (int i = 0; i < list.Count; i++)
            {
                Assert.Equal(list[i].Name, check[i].Name);
                Assert.Equal(list[i].Value, check[i].Value);
                Assert.Equal(list[i].Enabled, check[i].Enabled);
                Assert.Equal(list[i].EnabledStartDate, check[i].EnabledStartDate);
                Assert.Equal(list[i].EnabledEndDate, check[i].EnabledEndDate);
            }
        }
        public async Task Proto_vs_Json(int resourceSize, int recordCount)
        {
            //Arrange
            string cultureCode = "en-US";

            var sb = new StringBuilder(1000);

            for (int i = 0; i < resourceSize; i++)
            {
                sb.Append("X");
            }
            var list = new List <ContentItem>();

            for (int i = 0; i < recordCount; i++)
            {
                list.Add(new ContentItem {
                    Name             = "Item" + i,
                    Value            = sb.ToString(),
                    Enabled          = true,
                    EnabledStartDate = new DateTime(2020, 1, 1),
                    EnabledEndDate   = new DateTime(2020, 1, 31)
                });
            }


            var jsonStore  = new JsonFileContentSource(_location);
            var protoStore = new ProtoFileContentSource(_location, new NullContentLogger())
            {
                NextSource = new MockContentSource()
            };


            for (int i = 0; i < 3; i++)
            {
                var swJson = Stopwatch.StartNew();
                await jsonStore.SaveAllContentItemsAsync(cultureCode, list);

                swJson.Stop();
                var jsonFile = new FileInfo(jsonStore.GetCultureFileName(cultureCode));
                _output.WriteLine($"Json Save at {swJson.ElapsedMilliseconds:#,#}. ValueSize: {resourceSize:#,#}, Count: {recordCount:#,#},  FileSize: {jsonFile.Length:#,#}");


                var swProto = Stopwatch.StartNew();
                await protoStore.SaveAllContentItemsAsync(cultureCode, list);

                swProto.Stop();
                var protoFile = new FileInfo(protoStore.GetCultureFileName(cultureCode));
                _output.WriteLine($"Proto Save at {swProto.ElapsedMilliseconds:#,#}. ValueSize: {resourceSize:#,#}, Count: {recordCount:#,#},  FileSize: {protoFile.Length:#,#}");
            }

            for (int i = 0; i < 3; i++)
            {
                var swJson = Stopwatch.StartNew();
                _ = await jsonStore.GetAllContentItemsAsync(cultureCode, null);

                swJson.Stop();
                var jsonFile = new FileInfo(jsonStore.GetCultureFileName(cultureCode));
                _output.WriteLine($"Json Load at {swJson.ElapsedMilliseconds:#,#}. ValueSize: {resourceSize:#,#}, Count: {recordCount:#,#}, FileSize: {jsonFile.Length:#,#}");


                var swProto = Stopwatch.StartNew();
                _ = await protoStore.GetAllContentItemsAsync(cultureCode, null);

                swProto.Stop();
                var protoFile = new FileInfo(protoStore.GetCultureFileName(cultureCode));
                _output.WriteLine($"Proto Load at {swProto.ElapsedMilliseconds:#,#}. ValueSize: {resourceSize:#,#}, Count: {recordCount:#,#}, FileSize: {protoFile.Length::#,#}");
            }
        }