public void Can_derive_view_identifier_from_example() { var example = new ExampleDesignDocument(); var viewIdentifier = example.GetViewIdentifier(() => ExampleDesignDocument.Views.MyView1); Assert.Equal("example", viewIdentifier.DesignDocumentName); Assert.Equal("_design/example", viewIdentifier.DesignDocumentId); Assert.Equal("my_view1", viewIdentifier.ViewId); }
public void AnalyzerNotSerializedIfNotProvided() { var example = new ExampleDesignDocument(); var json = DesignDocumentConvert.Serialize(example); _output.WriteLine(json); // Compare with the serialized value to ensure the analyzer property isn't serialized // at all if none was provided. // Testing that the `analyzer` attribute on the deserialized object is `null` (which // is the returned value for undefined attributes) would be an improper test, as it // would also pass in the case where the analyzer is simply serialized as `null`, which // is not desired. Assert.DoesNotContain("analyzer", json); }
public void Example_document_contains_all_specified_members() { var example = new ExampleDesignDocument(); var json = DesignDocumentConvert.Serialize(example); _output.WriteLine(json); dynamic deserialized = JsonConvert.DeserializeObject(json); Assert.Equal("_design/example", (string)deserialized._id); Assert.Contains("view1 map", (string)deserialized.views.my_view1.map); Assert.Contains("view2 map", (string)deserialized.views.my_view2.map); Assert.Contains("view2 reduce", (string)deserialized.views.my_view2.reduce); Assert.Contains("show", (string)deserialized.shows.my_show); Assert.Contains("list", (string)deserialized.lists.my_list); Assert.Contains("update", (string)deserialized.updates.my_update); Assert.Contains("filter", (string)deserialized.filters.my_filter); Assert.Contains("index", (string)deserialized.indexes.my_index.index); Assert.Contains("validate_doc_update", (string)deserialized.validate_doc_update); }