public IBuildParameterValueBuilder Parameter(string name, string value, Action<IBuildParameterTypeBuilder> typeBuilder) { var builder = new BuildParameterTypeBuilder(); typeBuilder(builder); var rawValue = builder.Build(); if (string.IsNullOrEmpty(rawValue)) return Parameter(name, value); m_Properties.Add(new Property { Name = name, Value = value, Type = new PropertyType { RawValue = rawValue } }); return this; }
public IBuildParameterValueBuilder Parameter(string name, string value, Action <IBuildParameterTypeBuilder> typeBuilder) { var builder = new BuildParameterTypeBuilder(); typeBuilder(builder); var rawValue = builder.Build(); if (string.IsNullOrEmpty(rawValue)) { return(Parameter(name, value)); } m_Properties.Add(new Property { Name = name, Value = value, Type = new PropertyType { RawValue = rawValue } }); return(this); }
public void BuildParameterTypeBuilder_FormatTest(int type, int display, string label, string description, string expected) { // Arrange var testObject = new BuildParameterTypeBuilder(); var typeMap = new Dictionary<int, Action> { {0, () => { }}, {1, () => testObject.AsPassword()} }; if (!typeMap.ContainsKey(type)) Assert.Inconclusive("Wrong 'type' argument value passed"); typeMap[type](); var displayMap = new Dictionary<int, Action> { {0, () => { }}, {1, () => testObject.WithDisplayNormal()}, {2, () => testObject.WithDisplayPrompt()}, {3, () => testObject.WithDisplayHidden()} }; if (!displayMap.ContainsKey(display)) Assert.Inconclusive("Wrong 'display' argument value passed"); displayMap[display](); if (label != null) testObject.WithLabel(label); if (description != null) testObject.WithDescription(description); // Act var result = testObject.Build(); // Assert result.Should().Be(expected); }