public void GettingComputerByNullManufacturer_Throws()
        {
            manager.AddComputer(first);

            Assert.Throws <ArgumentNullException>(()
                                                  => manager.GetComputer(null, "A"));
        }
Пример #2
0
 public void GetCompTrhow_WhenNull(string a, string b)
 {
     Assert.That(() =>
     {
         computerManager.GetComputer(a, b);
     }, Throws.ArgumentNullException);
 }
 public void GetComputerThrowsExceptionIfComputerDoesNotExist()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         compManager.GetComputer("TestManufacturer", "TestModel");
     });
 }
 public void GetComputer_ShouldThrowExeption_WhenComputerIsNull()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         manager.GetComputer(computer1.Manufacturer, computer1.Model);
     });
 }
Пример #5
0
        public void GetComputer_WhenGetsComputer()
        {
            computerManager.AddComputer(computer);
            var result = computerManager.GetComputer(initialManufacturer, initialModel);

            Assert.AreEqual(result, computer);
        }
Пример #6
0
        public void Test_GetComputerReturnsExceptionWithFirstFieldNull()
        {
            computerMenager.AddComputer(computer);

            Assert.That(() =>
                        computerMenager.GetComputer(null, "Gosho"),
                        Throws.ArgumentNullException);
        }
Пример #7
0
        public void GetComputerShouldThrowArgumenExceptionIfCOmputerDoesntExist()
        {
            Computer computer = new Computer("HP", "Device200", 700);

            this.computerManager.AddComputer(computer);

            Assert.Throws <ArgumentException>(() => computerManager.GetComputer("Lenovo", "2030"));
        }
Пример #8
0
        public void GetComputerShouldThrowExceptionOnInvalidData()
        {
            ComputerManager manager = new ComputerManager();

            Assert.Throws <ArgumentNullException>(() => manager.GetComputer("HP", null));
            Assert.Throws <ArgumentNullException>(() => manager.GetComputer(null, "HP"));
            Assert.Throws <ArgumentException>(() => manager.GetComputer("HP", "HP"));
        }
Пример #9
0
        public void GetComputerShouldReturnProperly()
        {
            this.pcMan.AddComputer(this.computer);

            Computer actual = pcMan.GetComputer("Test", "TestModel");

            Assert.AreSame(this.computer, actual);
        }
        public void GetComputerShouldThrowExceptionOnInvalidData()
        {
            var computerManager = new ComputerManager();

            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer("Test", null));
            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer(null, "Test"));
            Assert.Throws <ArgumentException>(() => computerManager.GetComputer("Test", "test"));
        }
Пример #11
0
        public void GetComputerWorksCorrectly()
        {
            manager.AddComputer(computerOne);
            manager.AddComputer(computerTwo);

            var computer = manager.GetComputer(computerOne.Manufacturer, computerOne.Model);

            Assert.That(computer, Is.EqualTo(computerOne));
        }
Пример #12
0
        public void ValidateNullValueMethodShouldThrowExceptionWhenObjectIsNull()
        {
            Computer nullPC  = null;
            Computer nullPC2 = new Computer(null, "Vostro", 1199.99m);

            Assert.Throws <ArgumentNullException>(() => pcMngr.AddComputer(nullPC));
            Assert.Throws <ArgumentNullException>(() => pcMngr.GetComputer(null, "Vostro"));
            Assert.Throws <ArgumentNullException>(() => pcMngr.GetComputer("Vostro", null));
        }
Пример #13
0
        public void RemoveComputer_ShouldWorksCorrectlyGetComputer()
        {
            var comp = new Computer("HP", "Laptop", 1200.0m);

            computerManager.AddComputer(comp);

            var getComp = computerManager.GetComputer("HP", "Laptop");

            Assert.That(comp, Is.EqualTo(getComp));
        }
Пример #14
0
        public void GetCompShlothrExcp()
        {
            ComputerManager manager = new ComputerManager();


            Assert.Throws <ArgumentNullException>(() => manager.GetComputer(null, "DJONI"));
            Assert.Throws <ArgumentNullException>(() => manager.GetComputer("DJONI", null));

            Assert.Throws <ArgumentException>(() => manager.GetComputer("ZaZA", "bOBI"));
        }
        public void GetComputer_WithInvalidArguments()
        {
            computerManager.AddComputer(computer);

            Exception ex = Assert.Throws <ArgumentException>(() =>
            {
                computerManager.GetComputer("HP", "something");
            });

            Assert.AreEqual(ex.Message, "There is no computer with this manufacturer and model.");
        }
Пример #16
0
        public void GetComputer_NullManufactureThrowException()
        {
            Computer computerRemove = new Computer(manufacture, model, price);

            computerManager.AddComputer(computerRemove);
            Computer computer2 = new Computer("Laptop", "Hp", 2000);

            computerManager.AddComputer(computer2);
            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer(null, model));
            Assert.That(() => computerManager.GetComputer(null, model), Throws.ArgumentNullException.With.Message.EqualTo("Can not be null! (Parameter 'manufacturer')"));
        }
Пример #17
0
        public void GetComputer_ShouldThrow_WhenComputerDataIsInvalid(string manufacturer, string model, decimal price)
        {
            // arrange
            var computerManager = new ComputerManager();
            var computer        = new Computer(manufacturer, model, price);

            // act, assert
            computerManager.AddComputer(computer);
            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer(null, "none"));
            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer("another", null));
        }
        public void GetComputer_ShouldThrowException_WhenInvalidArgumentsAreGiven()
        {
            //Arrange
            ComputerManager computerManager = new ComputerManager();

            // Act - Assert
            Assert.Throws <ArgumentNullException>
                (() => computerManager.GetComputer("Test", null));
            Assert.Throws <ArgumentNullException>
                (() => computerManager.GetComputer(null, "Test"));
            Assert.Throws <ArgumentException>(() => computerManager.RemoveComputer("Test", "Test"));
        }
Пример #19
0
        public void GetComputer_Should_ReturnComputer()
        {
            cm.AddComputer(twoThousand);
            cm.AddComputer(threeThousand);
            cm.AddComputer(fourThousand);

            Computer testComputer     = twoThousand;
            Computer returnedComputer = cm.GetComputer("Asus", "ROG2000");

            Assert.AreEqual(testComputer.Manufacturer, returnedComputer.Manufacturer);
            Assert.AreEqual(testComputer.Model, returnedComputer.Model);
            Assert.AreEqual(testComputer.Price, returnedComputer.Price);
        }
        public void GetComputerIsWorkingProperly()
        {
            Computer computer  = new Computer("Dawe", "Turbo", 44);
            Computer computer2 = new Computer("Op", "Mashina", 55);

            cm.AddComputer(computer2);
            cm.AddComputer(computer);

            var expected = computer;
            var actual   = cm.GetComputer("Dawe", "Turbo");

            Assert.AreSame(expected, actual);
        }
Пример #21
0
        public void Test4()
        {
            ComputerManager computerManager = new ComputerManager();


            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer("njksa", null));
        }
Пример #22
0
        public void Test17()
        {
            Computer        computer        = new Computer("name", "model", 1.23m);
            ComputerManager computerManager = new ComputerManager();

            Assert.Throws <ArgumentException>(() => computerManager.GetComputer("name", "nakjda"));
        }
        public void Get_Computers__Method_Should_Throw_An_Exception_If_The_Model_Is_Null()
        {
            var computerManager = new ComputerManager();

            Assert.Throws <ArgumentNullException>(
                () => computerManager.GetComputer("10", null),
                "Value is not null.");
        }
Пример #24
0
        public void Test3()
        {
            Computer        computer        = new Computer("name", "model", 1.23m);
            ComputerManager computerManager = new ComputerManager();


            Assert.Throws <ArgumentNullException>(() => computerManager.GetComputer("njksa", null));
        }
        public void Get_Computer_Method_Should_Throw_An_Exception_If_Computer_Is_Null()
        {
            var computerManager = new ComputerManager();

            Assert.Throws <ArgumentException>(
                () => computerManager.GetComputer("1", "1"),
                "This computer is not null.");
        }
Пример #26
0
        public void IsInGetComputerItemWeLookedForDoesNotExist()
        {
            Computer        comp    = new Computer("Apple", "MacBook", 1550.50M);
            ComputerManager manager = new ComputerManager();

            manager.AddComputer(comp);

            Assert.Throws <ArgumentException>(() => manager.GetComputer("Apple12", "MacBook15"));
        }
Пример #27
0
        public void GetComputerShouldWorkAsExpected()
        {
            ComputerManager manager   = new ComputerManager();
            Computer        computer1 = new Computer("HP", "HP", 1000);

            manager.AddComputer(computer1);
            var computerFromComputerManager = manager.GetComputer("HP", "HP");

            Assert.AreEqual(computer1, computerFromComputerManager);
        }
Пример #28
0
        public void ComputerManagerGetMethodReturn()
        {
            ComputerManager compMan = new ComputerManager();
            Computer        comp    = new Computer("DC", "A", (decimal)5.5);

            compMan.AddComputer(comp);
            Computer compRemoved = compMan.GetComputer("DC", "A");

            Assert.That(compRemoved, Is.EqualTo(compRemoved));
        }
Пример #29
0
        public void GetComputerModelCanNotBeNull()
        {
            Computer        comp    = new Computer("Apple", "MacBook", 1550.50M);
            ComputerManager manager = new ComputerManager();

            manager.AddComputer(comp);


            Assert.Throws <ArgumentNullException>(() => manager.GetComputer("Apple", null));
        }
Пример #30
0
        public void IsGetComputerMethodReturnsCorrectComp()
        {
            Computer        comp    = new Computer("Apple", "MacBook", 1550.50M);
            ComputerManager manager = new ComputerManager();

            manager.AddComputer(comp);


            Assert.AreEqual(comp, manager.GetComputer("Apple", "MacBook"));
        }