示例#1
0
        public void TestCreate()
        {
            var p = new MediaFile()
            {
                Name    = "Ding" + DateTime.Now.ToString("yyyyMMddHHmmsszzz"),
                Content = ReadDing(),
            };

            var helper = new FilesManager();
            var id     = helper.Create(p);

            Assert.NotNull(id);
        }
示例#2
0
        public void TestRead()
        {
            var name = "ReadDing" + DateTime.Now.ToString("yyyyMMddHHmmsszzz");
            var p    = new MediaFile()
            {
                Name    = name,
                Content = ReadDing(),
            };

            var size   = p.Content.Length;
            var helper = new FilesManager();
            var id     = helper.Create(p);

            Assert.NotNull(id);
            var pr = helper.Read(id);

            Assert.Equal(name, pr.Name);
            Assert.Equal(size, pr.Content.Length);
        }
示例#3
0
        public void TestUpdate()
        {
            var p = new MediaFile()
            {
                Name    = "ReadDing",
                Content = ReadDing(),
            };

            var helper = new FilesManager();
            var id     = helper.Create(p);

            Assert.NotNull(id);
            var pr = helper.Read(id);

            Assert.Equal("ReadDing", pr.Name);

            pr.Name = "ReadDing";
            var ok = helper.Update(pr);

            Assert.True(ok);

            pr = helper.Read(id);
            Assert.Equal("ReadDing", pr.Name);
        }