Format:
Recent snippets for: lesnikowski
//This code outputs: 1234 const string s = "1234567890"; for(int i = 0; i < s.Length; i++ ) { if (s[i] == '5') break; Console.Write(s[i]); } Console.ReadLine();
190 Views
no comments
const string s = "1234567890"; for(int i = 0; i < s.Length; i++ ) { if (s[i] == '5') break; } // Covert to switch on if statement produces infinite loop:
127 Views
no comments
internal class SafeFileName { private static readonly List<char> _invalidPathChars = new List<char>(Path.GetInvalidPathChars()); private static readonly List<char> _invalidFileNameChars = new List<char>(Path.GetInvalidFileNameChars()); private readonly string _unsafePath; public SafeFileName(string unsafeFileName) { _unsafePath = unsafeFileName; }
156 Views
no comments
[Test]
public void AlghoritmUnderTest_2_Returns2Files()
{
FileInfo[] result = AlghoritmUnderTest();
CollectionAssert.AreEqual(new[] { "1.zip", "2.zip" }, result.Select(x => x.Name ));
}
246 Views
no comments
[Test] public void AlghoritmUnderTest_2_Returns2Files() { FileInfo[] result = AlghoritmUnderTest(); CollectionAssertExt.AreEqual(new[] { "1.zip", "2.zip" }, result, (x, y) => x == y.Name); }
104 Views
no comments
[Test]
public void AlghoritmUnderTest_2_Returns2Files()
{
FileInfo[] result = AlghoritmUnderTest();
CollectionAssertExt.AreEqual(new[] { "1.zip", "2.zip" }, result, (x, y) => x == y.Name);
}
74 Views
no comments
[Test] public void Idle_ServerDisconnects_NoUnhandeledException() { bool unhandeledException = false; UnhandledExceptionEventHandler fail = (sender, args) => unhandeledException = true; try { AppDomain.CurrentDomain.UnhandledException += fail; WithLogin(client =>
123 Views
no comments
[Test] public void Method_Condition_Result() { using(TcpClient client = new TcpClient()) { // set timeout client.ReceiveTimeout = (int)TimeSpan.FromSeconds(1).TotalMilliseconds; // connect to perfectly working imap server client.Connect("mail.lesnikowski.com", 143);
593 Views
no comments
using (Imap client = new Imap()) { client.Connect(_server); client.Login(_user, _password); client.SelectInbox(); client.GetAll() .ConvertAll(uid => client.GetHeadersByUID(uid)) .ConvertAll(eml => new MailBuilder().CreateFromEml(eml).Subject) .ForEach(Console.WriteLine);
157 Views
no comments
[TestFixture] public class ObjectFactoryTests { [Test] public void ResetMemoryLeak() { for (int i = 1; i < 1000; i++) { ObjectFactory.Reset(); if (i % 10 == 0)
131 Views
no comments
PS C:\Users\Pawel> $builder = New-Object Lesnikowski.Mail.SimpleMailMessageBuilder PS C:\Users\Pawel> $uids = $imap.Search().Where([Lesnikowski.Client.IMAP.Expression]::Subject("link")).GetUIDList() PS C:\Users\Pawel> foreach ($uid in $uids ) { $builder.CreateFromEml($imap.GetMessageByUID($uid)).Date } 5 lutego 2010 21:50:29 PS C:\Users\Pawel> foreach ($uid in $uids ) { $builder.CreateFromEml($imap.GetMessageByUID($uid)).From } Address Name
185 Views
no comments
PS C:\Users\Pawel> [Reflection.Assembly]::LoadFile("c:\mail.dll") PS C:\Users\Pawel> $imap = new-object Lesnikowski.Client.IMAP.Imap PS C:\Users\Pawel> $imap.Connect("mail.lesnikowski.com") PS C:\Users\Pawel> $imap.User = "user" PS C:\Users\Pawel> $imap.Password = "password" PS C:\Users\Pawel> $imap.Login() PS C:\Users\Pawel> $imap.SelectInbox() MessageCount Recent Flags UIDValidity ------------ ------ ----- -----------
242 Views
no comments
[Test] public void Render_Foreach_CanUseRootData() { Assert.AreEqual( "List: Pawel Pawel.", Template .Create("List:{foreach Orders} {FirstName}{end}.") .DataFrom(_contact) .Render()); }
197 Views
no comments
<html> <body> Hi {FirstName} {LastName}, <br /> <p> Your account {if Verified}has{else}<strong>has not</strong>{end} been verified<br /> Your password is: {Password} </p> Here are your orders: <p>
161 Views
no comments
Contact contact = ...; string html = Template .FromFile("template.txt") .DataFrom(contact) .Render();
193 Views
1 comments
void dopelnienie(macierz_t *macierz) { int p,q,m,n,i,j; macierz_t dopElementu; dopElementu.lw = macierz->lw - 1; // has always one row less dopElementu.lk = macierz->lk - 1; // has always one column less alokuj_tablice_macierzy(&dopElementu); macierz_t dop;
173 Views
no comments
int wyznacznik(macierz_t *macierz) { macierz_t macierz1; macierz1.lw = macierz->lw; macierz1.lk = macierz->lk; alokuj_tablice_macierzy(&macierz1); for(int i=0; i<macierz->lw; i++) for(int j=0; j<macierz->lk; j++) macierz1.macierz[i][j] = macierz->macierz[i][j];
136 Views
no comments
Application application = Application.Launch("XXX.exe"); Window window = application.GetWindow("XXX", InitializeOption.NoCache);
269 Views
no comments
private static void ConfigureShell(IInitializationExpression config) { switch (Environment.OSVersion.Platform) { case PlatformID.Win32S: case PlatformID.Win32Windows: case PlatformID.Win32NT: case PlatformID.WinCE: case PlatformID.Xbox: config.ForRequestedType<ISystemShell>().TheDefaultIsConcreteType<WindowsShell>();
199 Views
3 comments
public class Task { private bool _cancel; private IService _service; public Task(IService service) { _service = service; }
158 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
