Beispiel #1
0
    public void ReturnsAPositiveInteger()
    {
        string    input1    = "89";
        BCounting bCounting = new BCounting(input1);

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

        Assert.AreEqual(true, result);
    }
Beispiel #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());
    }
Beispiel #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());
    }
Beispiel #5
0
 static void Main(string[] args)
 {
     BCounting bCounting = new BCounting(args[0]);
 }