public void Compose_when_unknown_token() { string input = "$(Server) $(Database) $(User) $(UnknownToken123) $(Password)"; string expected = "127.0.0.1 MYDATABASE user1 $(UnknownToken123) user1pass"; SqlConnectionStringBuilder connstr = new SqlConnectionStringBuilder() { DataSource = "127.0.0.1", InitialCatalog = "MYDATABASE", UserID = "user1", Password = "******", IntegratedSecurity = false }; IWindowsUser windowsUser = A.Fake <IWindowsUser>(); RunParamsProcessor processor = new RunParamsProcessor(windowsUser); string result = processor.Compose(input, connstr); Assert.Equal(expected, result); }
public void Compose_when_integrated_security() { string input = "$(Server) $(Database) $(User) $(Password)"; string expected = "127.0.0.1 MYDATABASE user1 "; SqlConnectionStringBuilder connstr = new SqlConnectionStringBuilder() { DataSource = "127.0.0.1", InitialCatalog = "MYDATABASE", IntegratedSecurity = true, }; IWindowsUser windowsUser = A.Fake <IWindowsUser>(); A.CallTo(() => windowsUser.Name).Returns("user1"); RunParamsProcessor processor = new RunParamsProcessor(windowsUser); string result = processor.Compose(input, connstr); Assert.Equal(expected, result); }