martes, 15 de julio de 2014
Code Kata Password Validator
I'va wacthed the Carlos Ble's screen cast and I've done the exercise in java.
The code lives in GitHub
Happy Kata!!
The code lives in GitHub
Happy Kata!!
martes, 3 de junio de 2014
MSTest Assert.AreEqual with List
I was doing sms code kata with tdd. I´ve found the problem with the Assert.AreEqual with list<T>.
CollectionAssert.AreEquivalent(listOne, listTwo) is the solution source
CollectionAssert.AreEquivalent(listOne, listTwo) is the solution source
jueves, 29 de mayo de 2014
Decorator Pattern in C#
I'm reading C# 3.0 Design Patterns by Judith Bisop
I've understood the decorator pattern.
Here is my little example for extending StreamReder class by password, when it reads.
I've understood the decorator pattern.
Here is my little example for extending StreamReder class by password, when it reads.
using System;
using System.IO;
namespace Decorator
{
public class LoginStream
{
private StreamReader _streamReader;
private string _password;
public LoginStream (StreamReader streamReader, string password){
_streamReader = streamReader;
_password = password;
}
public string Read (string password){
if (_password == password) {
return _streamReader.ReadToEnd ();
}
throw new Exception ("Ivalid Password");
}
}
}
And the tests: using System;
using System.IO;
using Decorator;
using NUnit.Framework;
namespace DecoratorTests
{
[TestFixture()]
public class Test
{
[Test()]
public void LoginStream_Read_return_string_when_has_a_valid_password ()
{
var stream = new StreamReader("/home/luis/tmp/Prueba/Prueba.sln");
var password = "password";
var loginStream = new LoginStream(stream, password);
var result = loginStream.Read(password);
Assert.IsNotEmpty (result);
}
[Test()]
[ExpectedException(typeof(Exception))]
public void LoginStraeam_Read_return_exception_when_has_an_invalid_password ()
{
var stream = new StreamReader("path");
var password = "password";
var loginStream = new LoginStream(stream, password);
loginStream.Read("invalidPassword");
Assert.Fail ("Exception expected");
}
}
}
lunes, 31 de marzo de 2014
Export html Table to csv
Some time ago a collegue in Adesis, he needed to export html table to csv file.
I´ve dicovered some new music
So this the solution. It works
I´ve dicovered some new music
So this the solution. It works
Export To Excel
Titulo tabla
Nombre
Provincia
Telefono/Fax
URL
Marcas
Aistribuidor Nombre
Tadrid
200 000 000
www.paginaweb.com
marcas
Bistribuidor Nombre
Sadrid
500 000 000
www.paginaweb.com
marcas
Cistribuidor Nombre
Sadrid
300 000 000
www.paginaweb.com
marcas
Distribuidor Nombre
Madrid
900 000 000
www.paginaweb.com
marcas
viernes, 21 de marzo de 2014
lunes, 17 de marzo de 2014
Suscribirse a:
Comentarios (Atom)