コード例 #1
0
        public void Test_IncludeLocations_Set(bool includeLocations)
        {
            var searchOptions = new SearchOptions();

            var result = searchOptions.IncludeLocations(includeLocations).ToJson().ToString(Formatting.None);

            var json = new JObject(new JProperty("ctl", new JObject()));

            if (includeLocations)
            {
                // ReSharper disable once ConditionIsAlwaysTrueOrFalse
                json.Add("includeLocations", includeLocations);
            }
            var expected = JsonConvert.SerializeObject(json, Formatting.None);

            Assert.Equal(expected, result);
        }