Example #1
0
    public void Upgrade_Ram_Should_Throw_Exception_With_Invalid_Number()
    {
        //Arrange

        var microsystems = new Microsystems();
        var computer     = new Computer(1, Brand.DELL, 2300, 15.6, "grey");
        var computer2    = new Computer(3, Brand.DELL, 2300, 15.6, "grey");
        var computer3    = new Computer(4, Brand.DELL, 2300, 15.6, "grey");
        var computer4    = new Computer(5, Brand.ACER, 2300, 15.6, "grey");

        //Act
        microsystems.CreateComputer(computer);
        microsystems.CreateComputer(computer2);
        microsystems.CreateComputer(computer3);
        microsystems.CreateComputer(computer4);

        //Assert

        Assert.Throws <ArgumentException>(() => microsystems.UpgradeRam(16, 12));
    }
    public void Upgrade_Ram_Should_Change_Ram()
    {
        //Arrange

        var microsystems = new Microsystems();
        var computer     = new Computer(1, Brand.DELL, 2300, 15.6, "grey");
        var computer2    = new Computer(3, Brand.DELL, 2300, 15.6, "grey");
        var computer3    = new Computer(4, Brand.DELL, 2300, 15.6, "grey");
        var computer4    = new Computer(5, Brand.ACER, 2300, 15.6, "grey");

        //Act
        microsystems.CreateComputer(computer);
        microsystems.CreateComputer(computer2);
        microsystems.CreateComputer(computer3);
        microsystems.CreateComputer(computer4);
        microsystems.UpgradeRam(16, 1);
        var expectedRam = 16;
        var actualRam   = microsystems.GetComputer(1).RAM;

        //Assert

        Assert.AreEqual(expectedRam, actualRam);
    }