public void GetItems_should_return_only_given_types()
        {
            var items = ClassUtilities.GetItems <SampleClassForUtilitiesTests, int?>(null);

            items.Should().NotBeNull();
            items.Count.Should().Be(1);
        }
        public void GetItems_should_define_multiple_filter_types()
        {
            var items = ClassUtilities.GetItems <SampleClassForUtilitiesTests>(null, typeof(int?), typeof(float));

            items.Should().NotBeNull();
            items.Count.Should().Be(2);
        }
        public void GetItemByName_should_get_valid_class_item_from_type(string name, object value, bool nullable, ClassItemType itemType)
        {
            var @class = ClassUtilities.GetItemByName <SampleClassForUtilitiesTests>(name);

            @class.Should().NotBeNull();
            @class.Name.Should().Be(name);
            @class.Value.Should().Be(value);
            @class.ItemType.Should().Be(itemType);
            @class.Nullable.Should().Be(nullable);
        }
        public void GetItems_should_return_every_types()
        {
            var @class = ClassUtilities.GetItems <SampleClassForUtilitiesTests>(null);

            @class.Should().NotBeNull();
            @class.Count.Should().Be(6);

            var intNullable = @class.Find(p => p.Name == "IntNullable");

            intNullable.Value.Should().Be(null);
            intNullable.ItemType.Should().Be(ClassItemType.Property);
        }
Пример #5
0
        void Generate()
        {
            if (ckGenerateConnection.Checked)
            {
                ClassUtilities.GenerateConnection(connectionString);
            }
            if (ckGenerateModel.Checked)
            {
                ClassUtilities.GenerateModel();
            }
            if (ckGenerateRepository.Checked)
            {
                ClassUtilities.GenerateRepository();
            }
            if (ckGenerateManipulation.Checked)
            {
                ClassUtilities.GenerateManipulation();
            }

            StringBuilder sbCreate = DatabaseUtilities.GenerateCreate();
            StringBuilder sbRead   = DatabaseUtilities.GenerateRead();
            StringBuilder sbUpdate = DatabaseUtilities.GenerateUpdate();
            StringBuilder sbDelete = DatabaseUtilities.GenerateDelete();

            Invoke((MethodInvoker) delegate()
            {
                txtOutput.AppendText("-----CREATE-----" + Environment.NewLine);
                txtOutput.AppendText(sbCreate.ToString());
                txtOutput.AppendText("-----READ-----" + Environment.NewLine);
                txtOutput.AppendText(sbRead.ToString());
                txtOutput.AppendText("-----UPDATE-----" + Environment.NewLine);
                txtOutput.AppendText(sbUpdate.ToString());
                txtOutput.AppendText("-----DELETE-----" + Environment.NewLine);
                txtOutput.AppendText(sbDelete.ToString());
            });
        }
        public void GetItemByName_should_get_by_filter(string name)
        {
            var item = ClassUtilities.GetItemByName <SampleClassForUtilitiesTests, string>(null, name);

            item.Name.Should().Be(name);
        }