Ejemplo n.º 1
0
        public void ThrowArgumentException_WhenNullParameterIsPassed()
        {
            //arrange
            var database = new Models.Database();

            //assert
            Assert.ThrowsException <ArgumentException>(() => database.GetList(null));
        }
Ejemplo n.º 2
0
        public void ThrowArgumentException_WhenInvalidParameterIsPassed()
        {
            //arrange
            var    database   = new Models.Database();
            string typeString = "Tomatoes";

            //assert
            Assert.ThrowsException <ArgumentException>(() => database.GetList(typeString));
        }
Ejemplo n.º 3
0
        public void ReturnListOfDesktopCompuers_WhenInvovedWithCorrespondingParameter()
        {
            //arrange
            var    database      = new Models.Database();
            var    desktopPcMock = new Mock <IDesktopComputer>();
            var    expected      = "mock";
            string typeString    = "desktoppc";

            desktopPcMock.Setup(x => x.Print()).Returns(expected);
            desktopPcMock.SetupGet(x => x.Name).Returns(typeString);
            database.AddProduct(desktopPcMock.Object);
            //act
            var result = database.GetList(typeString);

            //assert
            Assert.IsTrue(result.Contains(expected));
        }
Ejemplo n.º 4
0
        public void ReturnListOfLandlinephones_WhenInvovedWithCorrespondingParameter()
        {
            //arrange
            var    database   = new Models.Database();
            var    laptopMock = new Mock <ILandlinePhone>();
            var    expected   = "mock";
            string typeString = "landlinephone";

            laptopMock.Setup(x => x.Print()).Returns(expected);
            laptopMock.SetupGet(x => x.Name).Returns(typeString);
            database.AddProduct(laptopMock.Object);
            //act
            var result = database.GetList(typeString);

            //assert
            Assert.IsTrue(result.Contains(expected));
        }