public void SutWithSameValuesAreEqual(Name name) { var aParameter = new NameOnlyParameter(name); var anotherParameter = new NameOnlyParameter(name); Assert.Equal(aParameter, anotherParameter); Assert.Equal(aParameter.GetHashCode(), anotherParameter.GetHashCode()); }
public void WithParameterWithDiffParameterNameDoesNotSetIsSelected( NameOnlyParameter parameter, NameOnlyParameterViewModel sut) { Assert.NotEqual(parameter.Name, sut.Name); sut.WithParameter(parameter); Assert.False(sut.IsSelected); }
public void WithParameterWithSameParameterNameSetsIsSelected( [Frozen] Name name, NameOnlyParameter parameter, NameOnlyParameterViewModel sut) { Assert.Equal(parameter.Name, sut.Name); sut.WithParameter(parameter); Assert.True(sut.IsSelected); }
public override Maybe <IParameter> GetParameter() { if (!this.IsSelected) { return(Maybe.Empty <IParameter>()); } var parameter = new NameOnlyParameter(this.Name); return(Maybe.ToMaybe <IParameter>(parameter)); }
protected override IList <IParameter> GetParameters(string data, CmdApplicationMeta applicationMeta) { var connectionStringBuilder = GetConnectionStringBuilder(data); if (connectionStringBuilder == null) { return(default(IList <IParameter>)); } var returnList = new List <IParameter>(); var serverName = new NameValueParameter((Name)"-S", connectionStringBuilder["Server"] as string); var databaseName = connectionStringBuilder["Initial Catalog"] as string; if (string.IsNullOrEmpty(databaseName)) { databaseName = "<default>"; } var initialCatalog = new NameValueParameter((Name)"-d", databaseName); returnList.Add(serverName); returnList.Add(initialCatalog); var userId = connectionStringBuilder["user id"] as string; var password = connectionStringBuilder["password"] as string; IParameter username = null; if (!string.IsNullOrEmpty(userId)) { username = new NameValueParameter((Name)"-U", userId); returnList.Add(username); } IParameter pass = null; if (!string.IsNullOrEmpty(password)) { pass = new NameValueParameter((Name)"-P", password); returnList.Add(pass); } IParameter integratedSecurity = null; if ((bool)connectionStringBuilder["integrated Security"]) { integratedSecurity = new NameOnlyParameter((Name)"-E"); returnList.Add(integratedSecurity); } return(returnList); }
private CmdApplicationConfiguration CreateCmdApplicationConfiguration( string friendlyName, CmdApplicationMeta meta) { var parameterList = new List <IParameter>(); IParameter parameter = new NameOnlyParameter((Name)"-E"); parameterList.Add(parameter); parameter = new NameValueParameter((Name)"-S", "Value"); parameterList.Add(parameter); var configuration = new CmdApplicationConfiguration( (Name)friendlyName, (Name)meta.ApplicationName, new ReadOnlyCollection <IParameter>(parameterList)); return(configuration); }
public void GetValueReturnsExpected(string name, string expected) { var sut = new NameOnlyParameter((Name)name); Assert.Equal(expected, sut.GetValue()); }