Esempio n. 1
0
        public void Should_throw_exception(string base64String)
        {
            var model = new DiffInputModel {
                Data = base64String
            };

            model.GetBytes();
        }
Esempio n. 2
0
        public void Should_return_is_invalid(string base64String)
        {
            var model = new DiffInputModel {
                Data = base64String
            };

            var actual = model.IsValid();

            Assert.IsFalse(actual);
        }
Esempio n. 3
0
        public ActionResult Right(string id, [FromBody] DiffInputModel input)
        {
            if (input.IsValid() == false)
            {
                return(BadRequest(id));
            }

            _service.LoadOrCreate(id).SetRight(input.GetBytes()).Save();

            return(Ok(id));
        }
Esempio n. 4
0
        public void Should_return_bytes(string text)
        {
            var expected = Encoding.UTF8.GetBytes(text);

            var model = new DiffInputModel {
                Data = Convert.ToBase64String(expected)
            };

            var actual = model.GetBytes();

            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 5
0
        public void Should_return_is_valid(string text)
        {
            var bytes = Encoding.UTF8.GetBytes(text);

            var model = new DiffInputModel {
                Data = Convert.ToBase64String(bytes)
            };

            var actual = model.IsValid();

            Assert.IsTrue(actual);
        }