Exemplo n.º 1
0
    public void ReturnsAPositiveInteger()
    {
        string    input1    = "89";
        BCounting bCounting = new BCounting(input1);

        Assert.IsInstanceOf <Int32>(bCounting.Result());
    }
Exemplo n.º 2
0
    public void ResultsAreBinary()
    {
        string    input1    = "89";
        BCounting bCounting = new BCounting(input1);
        Boolean   result    = ChecksIfBinary(bCounting.ToBinary());

        Assert.AreEqual(true, result);
    }
Exemplo n.º 3
0
    public void CountsTheOnes()
    {
        string    input1     = "6";
        BCounting bCounting1 = new BCounting(input1);

        Assert.AreEqual(2, bCounting1.CountTheOnes());

        string    input2     = "93";
        BCounting bCounting2 = new BCounting(input2);

        Assert.AreEqual(5, bCounting2.CountTheOnes());

        string    input3     = "198";
        BCounting bCounting3 = new BCounting(input3);

        Assert.AreEqual(4, bCounting3.CountTheOnes());
    }
Exemplo n.º 4
0
    public void ConvertsInputToBinary()
    {
        string    input1     = "6";
        BCounting bCounting1 = new BCounting(input1);

        Assert.AreEqual("110", bCounting1.ToBinary());

        string    input2     = "93";
        BCounting bCounting2 = new BCounting(input2);

        Assert.AreEqual("1011101", bCounting2.ToBinary());

        string    input3     = "198";
        BCounting bCounting3 = new BCounting(input3);

        Assert.AreEqual("11000110", bCounting3.ToBinary());

        string    input4     = "375";
        BCounting bCounting4 = new BCounting(input4);

        Assert.AreEqual("101110111", bCounting4.ToBinary());
    }
Exemplo n.º 5
0
 static void Main(string[] args)
 {
     BCounting bCounting = new BCounting(args[0]);
 }