示例#1
0
        public async Task <FetchTogglesResult> FetchToggles()
        {
            var json = await GetJsonString(filePath);

            return(new FetchTogglesResult()
            {
                ToggleCollection = serializer.Deserialize <ToggleCollection>(json)
            });
        }
        public void Deserialize_WhenStringIsValidJson_FlagObjectReturned()
        {
            //Arrange
            var value = "{ \"features\" : [{ \"name\" : \"example-feature-flag\", \"enabled\": true }] }";

            //Act
            var result = serializer.Deserialize <ToggleCollection>(value);

            //Assert
            Assert.True(result.GetToggleByName("example-feature-flag").Enabled);
        }