Beispiel #1
0
        public void DocumentFieldConversions()
        {
            var media = new Data.Media()
            {
                Id = Guid.NewGuid()
            };

            Piranha.Extend.Fields.DocumentField field = media;
            Assert.Equal(media.Id, field.Id.Value);
        }
Beispiel #2
0
        public void DocumentFieldConversionsNullDocument()
        {
            var id = Guid.NewGuid();

            Piranha.Extend.Fields.DocumentField field = id;
            Assert.Equal(id, field.Id.Value);

            string url = field;

            Assert.Equal("", url);
        }
Beispiel #3
0
        public async Task DocumentFieldInitMissing()
        {
            using (var api = CreateApi()) {
                var field = new Piranha.Extend.Fields.DocumentField {
                    Id = Guid.NewGuid()
                };

                await field.Init(api);

                Assert.Null(field.Id);
            }
        }
Beispiel #4
0
        public void DocumentFieldInitMissing()
        {
            using (var api = new Api(GetDb(), new ContentServiceFactory(services), storage)) {
                var field = new Piranha.Extend.Fields.DocumentField {
                    Id = Guid.NewGuid()
                };

                field.Init(api);

                Assert.Null(field.Id);
            }
        }
Beispiel #5
0
        public void DocumentFieldNotEquals()
        {
            var field1 = new Piranha.Extend.Fields.DocumentField {
                Id = Guid.NewGuid()
            };
            var field2 = new Piranha.Extend.Fields.DocumentField {
                Id = null
            };

            Assert.True(field1 != field2);
            Assert.True(!field1.Equals(field2));
            Assert.True(!field1.Equals((object)field2));
        }