Esempio n. 1
0
        public void AddWaiter_ExceptionFromDataAccess()
        {
            var mock = new Mock <IManagerDataAccess>();

            mock.Setup(m => m.AddWaiter(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Throws(new Exception());

            //Arrange Bar Data Model
            var BarDataModel = new BarDataModel(mock.Object);

            //Act
            var result = BarDataModel.AddWaiter("Tom", "Dickens", "tDick", "lala");

            //Assert
            Assert.IsNull(result);
        }
Esempio n. 2
0
        public void AddWaiter_FailedAddinToDataBase()
        {
            //Arrange Waiter
            WaiterContext waiter = null;

            var mock = new Mock <IManagerDataAccess>();

            mock.Setup(m => m.AddWaiter(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(waiter);

            //Arrange Bar Data Model
            var BarDataModel = new BarDataModel(mock.Object);

            //Act
            var result = BarDataModel.AddWaiter("Tom", "Dickens", "tDick", "lala");

            //Assert
            Assert.IsNull(result);
        }
Esempio n. 3
0
        public void AddWaiter_ValidExample()
        {
            //Arrange Waiter
            var waiter = new MoqWaiter(1, "Tom", "Dickens", "tDick", "lala");

            var mock = new Mock <IManagerDataAccess>();

            mock.Setup(m => m.AddWaiter(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(waiter);

            //Arrange Bar Data Model
            var BarDataModel = new BarDataModel(mock.Object);

            //Act
            var result = BarDataModel.AddWaiter(waiter.FirstName, waiter.LastName, waiter.Login, waiter.Password);

            //Assert
            Assert.AreEqual(result, waiter);
        }
        public void AddWaiter_ValidExample()
        {
            //Arrange Waiter
            var waiter = new MoqWaiter(1, "Tom", "Dickens", "tDick", "lala");

            var mock = new Mock<IManagerDataAccess>();
            mock.Setup(m => m.AddWaiter(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(waiter);

            //Arrange Bar Data Model
            var BarDataModel = new BarDataModel(mock.Object);

            //Act
            var result = BarDataModel.AddWaiter(waiter.FirstName, waiter.LastName, waiter.Login, waiter.Password);

            //Assert
            Assert.AreEqual(result, waiter);
        }
        public void AddWaiter_FailedAddinToDataBase()
        {
            //Arrange Waiter
            WaiterContext waiter = null;

            var mock = new Mock<IManagerDataAccess>();
            mock.Setup(m => m.AddWaiter(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(waiter);

            //Arrange Bar Data Model
            var BarDataModel = new BarDataModel(mock.Object);

            //Act
            var result = BarDataModel.AddWaiter( "Tom", "Dickens", "tDick", "lala");

            //Assert
            Assert.IsNull(result);
        }
        public void AddWaiter_ExceptionFromDataAccess()
        {
            var mock = new Mock<IManagerDataAccess>();
            mock.Setup(m => m.AddWaiter(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Throws(new Exception());

            //Arrange Bar Data Model
            var BarDataModel = new BarDataModel(mock.Object);

            //Act
            var result = BarDataModel.AddWaiter("Tom", "Dickens", "tDick", "lala");

            //Assert
            Assert.IsNull(result);
        }