示例#1
0
        public void SerializeArgument_WorksForEnumerableObjectProperty()
        {
            // Arrange
            var args = new MockArgs();

            args.EnumerableObject = new MockArgs.MockObject[]
            {
                new MockArgs.MockObject
                {
                    Int    = 1,
                    String = "a",
                    Object = null
                },
                new MockArgs.MockObject
                {
                    Int    = 2,
                    String = "",
                    Object = false
                },
            };
            // Act
            var result = args.SerializeArgument(nameof(MockArgs.EnumerableObject));

            // Assert
            Assert.Equal("-enumerable_object:\"Int=1;String=a;\" -enumerable_object:\"Int=2;String=;Object=False;\"", result);
        }
示例#2
0
        public void SerializeArgument_WorksForEnumerableProperty()
        {
            // Arrange
            var args = new MockArgs();

            args.Enumerable = new object[] { "a", 1, true };
            // Act
            var result = args.SerializeArgument(nameof(MockArgs.Enumerable));

            // Assert
            Assert.Equal("-enumerable:\"a\" -enumerable:\"1\" -enumerable:\"True\"", result);
        }
示例#3
0
        public void SerializeArgument_WorksForProperty_SetByKey_GetProperty()
        {
            // Arrange
            var args = new MockArgs();

            args["argument"] = "value";
            // Act
            var result = args.SerializeArgument(nameof(MockArgs.Argument));

            // Assert
            Assert.Equal("-argument:\"value\"", result);
        }
示例#4
0
        public void SerializeArgument_WorksForObjectProperty()
        {
            // Arrange
            var args = new MockArgs();

            args.Object = new MockArgs.MockObject
            {
                Int    = 1,
                String = "a",
                Object = null
            };
            // Act
            var result = args.SerializeArgument(nameof(MockArgs.Object));

            // Assert
            Assert.Equal("-object:\"Int=1;String=a;\"", result);
        }