예제 #1
0
        public void Document_WithConventionId_WhenAccessingId_ShouldMatchTheContent()
        {
            string id = "doc-id";

            var myContent = new TestContentStringId
            {
                Id        = id,
                AnyNumber = 5
            };

            var myDoc = new Document <TestContentStringId>(myContent);

            Assert.Equal(id, myDoc.Id);
        }
예제 #2
0
        public void Document_WithoutMatchingIdTypes_WhenAccessingId_ShouldThrowException()
        {
            string id = "doc-id";

            var myContent = new TestContentStringId
            {
                Id        = id,
                AnyNumber = 5
            };

            var myDoc = new Document <TestContentStringId, Guid>(myContent);

            Assert.Throws <InvalidOperationException>(() => myDoc.Id);
        }