Ejemplo n.º 1
0
    void DrawCustomEntries()
    {
        SerializedObject serializedObject = new SerializedObject(SimpleExample.Instance);

        List <TableColumn> columns = new List <TableColumn>()
        {
            new TableColumn("String", 60f),
            new TableColumn("Float", 50f),
            new TableColumn("Object", 110f),
            new TableColumn("", 100f)
            {
                enabledTitle = false
            },
        };

        List <List <TableEntry> > rows = new List <List <TableEntry> >();

        SimpleExample targetObject = (SimpleExample)serializedObject.targetObject;

        for (int i = 0; i < targetObject.simpleObjects.Count; i++)
        {
            SimpleExample.SimpleObject entry = targetObject.simpleObjects[i];
            rows.Add(new List <TableEntry>()
            {
                new LabelEntry(entry.stringProperty),
                new PropertyEntry(serializedObject, string.Format("simpleObjects.Array.data[{0}].floatProperty", i)),
                new PropertyEntry(serializedObject, string.Format("simpleObjects.Array.data[{0}].objectProperty", i)),
                new ActionEntry("Reset", () => entry.Reset()),
            });
        }

        tableState = GUITable.DrawTable(columns, rows, tableState);
    }
    void DrawCustomCells()
    {
        SerializedObject serializedObject = new SerializedObject(SimpleExample.Instance);

        List <TableColumn> columns = new List <TableColumn>()
        {
            new TableColumn("String", TableColumn.Width(60f)),
            new TableColumn("Float", TableColumn.Width(50f)),
            new TableColumn("Object", TableColumn.Width(110f)),
            new TableColumn("", TableColumn.Width(100f), TableColumn.EnabledTitle(false)),
        };

        List <List <TableCell> > rows = new List <List <TableCell> >();

        SimpleExample targetObject = (SimpleExample)serializedObject.targetObject;

        for (int i = 0; i < targetObject.simpleObjects.Count; i++)
        {
            SimpleExample.SimpleObject entry = targetObject.simpleObjects[i];
            rows.Add(new List <TableCell>()
            {
                new LabelCell(entry.stringProperty),
                new PropertyCell(serializedObject, string.Format("simpleObjects.Array.data[{0}].floatProperty", i)),
                new PropertyCell(serializedObject, string.Format("simpleObjects.Array.data[{0}].objectProperty", i)),
                new ActionCell("Reset", () => entry.Reset()),
            });
        }

        tableState = GUITableLayout.DrawTable(tableState, columns, rows);
    }
Ejemplo n.º 3
0
 static void Main(string [] args)
 {
     SimpleExample.Execute(args);
     DefaultValueExample.Execute(args);
     AltNamesExample.Execute(args);
     MixedConfigsExample.Execute(args);
     SettingsForSettings.Execute(args);
 }
Ejemplo n.º 4
0
 public static void Main()
 {
     login = new TestLoginHelper();
     workbooks = login.testLogin();
     SimpleExample simpleEx = new SimpleExample ();
     simpleEx.createOrganisations (true, true, true);
     simpleEx.getOrganisations ();
     login.testExit(workbooks, 0);
 }
Ejemplo n.º 5
0
    public static void Main()
    {
        login     = new TestLoginHelper();
        workbooks = login.testLogin();
        SimpleExample simpleEx = new SimpleExample();

        simpleEx.createOrganisations(true, true, true);
        simpleEx.getOrganisations();
        login.testExit(workbooks, 0);
    }
Ejemplo n.º 6
0
        private static void Main(string[] args)
        {
            var e = new SimpleExample();

            e.ExecuteSaveExample();

            /**********************************
            * All Done
            **********************************/
            Console.WriteLine("All Done. Press Enter to Continue...");
            Console.ReadKey();
        }
Ejemplo n.º 7
0
    public void Serialize_ShouldEscapeDoubleQuote()
    {
        const string expected = @"Count,Flag,Description
5,True,""This is a quote""""";

        var input = new SimpleExample
        {
            Count       = 5,
            Flag        = true,
            Description = "This is a quote\""
        };

        var result = CsvConvert.Serialize(input);

        Assert.That(result, Is.EqualTo(expected));
    }
Ejemplo n.º 8
0
    public void SerializeSingleObject()
    {
        const string expected = @"Count,Flag,Description
5,True,""This is the description""";

        var input = new SimpleExample
        {
            Count       = 5,
            Flag        = true,
            Description = "This is the description"
        };

        var result = CsvConvert.Serialize(input);

        Assert.That(result, Is.EqualTo(expected));
    }
Ejemplo n.º 9
0
        public void Passes_all_validation()
        {
            var sut = new SimpleExample
            {
                IntegerA     = 100,
                StringB      = "test-100",
                BoolC        = true,
                ExampleEnumD = ExampleEnum.ValueB
            };

            var validationResults = new List <ValidationResult>();
            var result            = _validator.TryValidateObjectRecursive(sut, validationResults);

            Assert.True(result);
            Assert.Empty(validationResults);
        }
Ejemplo n.º 10
0
    public void Serialize_ShouldNotEmitHeader()
    {
        const string expected = @"5,True,""This is the description""";

        var input = new SimpleExample
        {
            Count       = 5,
            Flag        = true,
            Description = "This is the description"
        };

        var result = CsvConvert.Serialize(input, new CsvConvertSettings {
            EmitHeader = false
        });

        Assert.That(result, Is.EqualTo(expected));
    }
Ejemplo n.º 11
0
    public void Serialize_EscapeStringsWithSeparator()
    {
        const string expected = @"Count!Flag!Description
5!True!""Hi!""";

        var input = new SimpleExample
        {
            Count       = 5,
            Flag        = true,
            Description = "Hi!"
        };

        var result = CsvConvert.Serialize(input, new CsvConvertSettings
        {
            Separator = '!'
        });

        Assert.That(result, Is.EqualTo(expected));
    }
Ejemplo n.º 12
0
        public void Indicate_that_StringB_and_BoolC_are_missing()
        {
            var sut = new SimpleExample
            {
                IntegerA = 102,
                StringB  = null,
                BoolC    = null
            };

            var validationResults = new List <ValidationResult>();
            var result            = _validator.TryValidateObjectRecursive(sut, validationResults);

            Assert.False(result);
            Assert.NotEmpty(validationResults);
            Assert.NotNull(validationResults
                           .FirstOrDefault(x => x.MemberNames.Contains(nameof(SimpleExample.StringB))));
            Assert.NotNull(validationResults
                           .FirstOrDefault(x => x.MemberNames.Contains(nameof(SimpleExample.BoolC))));
        }
Ejemplo n.º 13
0
        public void Indicate_that_StringB_is_missing()
        {
            var sut = new SimpleExample
            {
                IntegerA     = 102,
                StringB      = null,
                BoolC        = true,
                ExampleEnumD = ExampleEnum.ValueA
            };

            const string fieldName         = nameof(SimpleExample.StringB);
            var          validationResults = new List <ValidationResult>();
            var          result            = _validator.TryValidateObjectRecursive(sut, validationResults);

            Assert.False(result);
            Assert.NotEmpty(validationResults);
            Assert.NotNull(validationResults
                           .FirstOrDefault(x => x.MemberNames.Contains(fieldName)));
        }
Ejemplo n.º 14
0
        public void Indicate_that_IntegerA_and_ExampleEnumD_are_missing()
        {
            var sut = new SimpleExample
            {
                IntegerA     = null,
                StringB      = "test-106",
                BoolC        = true,
                ExampleEnumD = null
            };

            var validationResults = new List <ValidationResult>();
            var result            = _validator.TryValidateObjectRecursive(sut, validationResults);

            Assert.False(result);
            Assert.NotEmpty(validationResults);
            Assert.NotNull(validationResults
                           .FirstOrDefault(x => x.MemberNames.Contains(nameof(SimpleExample.IntegerA))));
            Assert.NotNull(validationResults
                           .FirstOrDefault(x => x.MemberNames.Contains(nameof(SimpleExample.ExampleEnumD))));
        }
 public RandomClass()
 {
     s = new SimpleExample(() => myValue);
 }
Ejemplo n.º 16
0
 static void Main(string[] args)
 {
     SimpleExample.Run();
     //SequentialSteps.Run();
 }