コード例 #1
0
        public void ThrowArgumentException_WhenTryingToRemoveProductWhoIsNotInCollection()
        {
            //arrange
            var database = new Models.Database();

            var productStub = new Mock <IProduct>();

            //act
            database.RemoveProduct(productStub.Object);
        }
コード例 #2
0
        public void ThrowArgumentNullException_WhenNullParameterIsPassed()
        {
            //arrange
            var database    = new Models.Database();
            var productStub = new Mock <IProduct>();

            //act
            database.RemoveProduct(null);
            //assert
        }
コード例 #3
0
        public void RemoveExistingProductFromCollectionCorrectly_WhenValidObjectIsPassed()
        {
            //arrange
            var database    = new Models.Database();
            var productStub = new Mock <IProduct>();

            //act
            database.AddProduct(productStub.Object);
            database.RemoveProduct(productStub.Object);
            //assert
            Assert.IsTrue(database.Products.Count == 0);
        }