public void WhenDeletingNonExistingProduct_ThenReturnsFalse()
        {
            var manager = Mocks.Of <IPatternManager>().First(x => x.Products == new IProduct[0] && x.IsOpen == true);

            var result = PatternManagerExtensions.Delete(manager, "foo");

            Assert.False(result);
        }
        public void WhenDeletingExistingProduct_ThenDeletesInstanceFromManager()
        {
            var product = Mocks.Of <IProduct>().First(x => x.InstanceName == "Foo");
            var manager = Mocks.Of <IPatternManager>().First(x => x.Products == new[] { product } && x.IsOpen == true);

            PatternManagerExtensions.Delete(manager, "Foo");

            Mock.Get(manager).Verify(x => x.DeleteProduct(product));
        }
 public void WhenDeletingWithNullProductName_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => PatternManagerExtensions.Delete(new Mock <IPatternManager>().Object, null));
 }
 public void WhenDeleteWithEmptyProductName_ThenThrowsArgumentOutOfRangeException()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => PatternManagerExtensions.Delete(new Mock <IPatternManager>().Object, string.Empty));
 }
 public void WhenDeletingWithNullManager_ThenThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => PatternManagerExtensions.Delete(null, "foo"));
 }