Ejemplo n.º 1
0
        public void AddItem_OneItem_NoOfItemsIs1()
        {
            //Arrange

            //Act
            uut.AddItem(12.50);

            //Assert
            Assert.That(uut.GetNoOfItems(), Is.EqualTo(1));
        }
Ejemplo n.º 2
0
 public void Add_NegativeItem_Throws()
 {
     Assert.That(
         () => uut_.AddItem(-1),
         Throws.TypeOf <System.ArgumentException>()
         );
 }
Ejemplo n.º 3
0
        public void AddItem_OneItem_NItemsIsCorrect()
        {
            // Arrange
            var uut = new Register();

            // Act
            uut.AddItem(45.0);

            // Assert
            Assert.That(uut.GetNItems(), Is.EqualTo(1));
        }
Ejemplo n.º 4
0
        public void AddItem_OneItem_TotalIsCorrect(double itemPrice)
        {
            // Arrange
            var uut = new Register();

            // Act
            uut.AddItem(itemPrice);

            // Assert
            Assert.That(uut.GetTotal(), Is.EqualTo(itemPrice).Within(0.005));
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var register = new Register();

            register.AddItem(23.0);

            Console.WriteLine($"Antal items: {register.NItems}");
            Console.WriteLine($"Total: {register.Total}");

            var c = Console.ReadKey();
        }
Ejemplo n.º 6
0
        public void AddItem_OneItem_NoOfItemsReturns1()
        {
            // Arrange in Setup

            // Act
            uut.AddItem(12.55);

            // Assert
            Assert.That(uut.GetNItems(), Is.EqualTo(1));
        }
Ejemplo n.º 7
0
 public void Add_AddItem_NumberCorrect()
 {
     uut.AddItem(11.22);
     Assert.That(uut.NoOfItems, Is.EqualTo(1));
 }
Ejemplo n.º 8
0
    private void RegisterItems()
    {
        Item grassBlock = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(0),
            id    = 0
        };

        register.AddItem(grassBlock);

        Item dirtBlock = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(1),
            id    = 1
        };

        register.AddItem(dirtBlock);

        Item stoneBlock = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(2),
            id    = 2
        };

        register.AddItem(stoneBlock);

        Item woodenPlanksBlock = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(3),
            id    = 3
        };

        register.AddItem(woodenPlanksBlock);

        Item woodBlock = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(4),
            id    = 4
        };

        register.AddItem(woodBlock);

        Item coalOre = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(5),
            id    = 5
        };

        register.AddItem(coalOre);

        Item glassBlock = new Item
        {
            type  = ItemType.Block,
            block = register.GetBlock(6),
            id    = 6
        };

        register.AddItem(glassBlock);
    }
Ejemplo n.º 9
0
 public void Add_NegativeItem_Throws()
 {
     Assert.That(() => uut.AddItem(-23.56), Throws.ArgumentException.With.Property("Message").EqualTo("Negativ item værdi"));
 }