예제 #1
0
        public void NullableBoolTest()
        {
            var builder = new GenericUserInterfaceModelBuilder <Type1>(TestsHelper.CreateDefaultBag());

            var result = builder.Result.Interface;

            Assert.AreEqual(1, result.Blocks.Count);

            var block = result.Blocks.First();

            Assert.AreEqual(UserInterfaceType.DropDownList, block.InterfaceType);

            var selectList = block.DropDownData.SelectList;

            Assert.IsTrue(selectList.Count == 3);

            var firstSelectItem = selectList.First();

            Assert.IsTrue(firstSelectItem.Selected);
            Assert.IsNull(firstSelectItem.Value);
        }
예제 #2
0
        public void OrdinaryBoolTest()
        {
            var builder = new GenericUserInterfaceModelBuilder <Type2>(TestsHelper.CreateDefaultBag());

            var result = builder.Result.Interface;

            Assert.AreEqual(1, result.Blocks.Count);

            var block = result.Blocks.First();

            Assert.AreEqual(UserInterfaceType.DropDownList, block.InterfaceType);

            var selectList = block.DropDownData.SelectList;

            //Так как жто не Nullable null быть не должно
            Assert.IsFalse(selectList.Any(x => x.Value == null));

            Assert.IsTrue(selectList.Count == 2);

            var firstSelectItem = selectList.First();

            Assert.IsTrue(firstSelectItem.Selected);
            Assert.IsFalse(bool.Parse(firstSelectItem.Value));
        }
예제 #3
0
        public void Test()
        {
            var interfaceModel = new GenericUserInterfaceModelBuilder <TypeWithInteger>(TestsHelper.CreateDefaultBag()).Result;

            var prop1Block = interfaceModel.Interface.Blocks.First();

            Assert.AreEqual(UserInterfaceType.NumberBox, prop1Block.InterfaceType);

            var textBoxData = prop1Block.NumberBoxData;

            Assert.IsNotNull(textBoxData);
            Assert.IsTrue(textBoxData.IsInteger);
            Assert.AreEqual(Tool.JsonConverter.Serialize(int.MinValue), textBoxData.MinValue);
            Assert.AreEqual(Tool.JsonConverter.Serialize(int.MaxValue), textBoxData.MaxValue);
        }
예제 #4
0
        public void NullableEnumTest()
        {
            var result = new GenericUserInterfaceModelBuilder <Type1WithNullableEnum>(TestsHelper.CreateDefaultBag()).Result;

            var fProp = result.Interface.Blocks.First();

            Assert.AreEqual(Enumerations.UserInterfaceType.DropDownList, fProp.InterfaceType);

            var selectList = fProp.DropDownData.SelectList;

            Assert.AreEqual(3, selectList.Count);

            var fItem = selectList.First();

            Assert.IsTrue(fItem.Selected);

            Assert.IsNull(fItem.Value);
        }
예제 #5
0
        public void Test()
        {
            var descr = new GenericUserInterfaceModelBuilder <ModelWithLabel>(TestsHelper.CreateDefaultBag()).Result;

            Assert.AreEqual(SomeValue, descr.Interface.Blocks.First().LabelText);
        }