예제 #1
0
        public void NonAutoNullBodyTest()
        {
            var generator = new GetBodyGenerator();
            var bodyData  = new BodyData()
            {
                IsAuto = false, Body = ""
            };

            Assert.Throws(typeof(InvalidOperationException), () => generator.Generate(bodyData));
        }
예제 #2
0
        public void AutoBodyTest()
        {
            var generator = new GetBodyGenerator();
            var bodyData  = new BodyData()
            {
                IsAuto = true, Body = "ShouldBeIgnored"
            };
            var result = generator.Generate(bodyData);

            Assert.AreEqual("get;", result);
        }
예제 #3
0
        public void NonAutoBodyTest()
        {
            var generator = new GetBodyGenerator();
            var bodyData  = new BodyData()
            {
                IsAuto = false, Body = "return 0;"
            };
            var result = generator.Generate(bodyData);

            Assert.AreEqual(@"get { return 0; }", result);
        }
예제 #4
0
        public void InvalidDataTypeTest()
        {
            var generator = new GetBodyGenerator();

            Assert.Throws(typeof(InvalidOperationException), () => generator.Generate(123));
        }
예제 #5
0
        public void NullDataTest()
        {
            var generator = new GetBodyGenerator();

            Assert.Throws(typeof(ArgumentNullException), () => generator.Generate(null));
        }