Пример #1
0
        public void when_loading_store_then_loads_product_and_associates_schema_and_store()
        {
            var store = new ProductStore(
                "ProductStoreFixture.Simple.json",
                new JsonProductSerializer(),
                Mock.Of<IToolkitCatalog>(c => c.Find("SimpleToolkit") ==
                    Mock.Of<IToolkitInfo>(t => t.Products == new[]
                    {
                        Mock.Of<IProductInfo>(p =>
                            p.Toolkit == Mock.Of<IToolkitInfo>() &&
                            p.SchemaId == "NuPattern.Tookit.Simple.IAmazonWebServices")
                    })));

            store.Load(NullProgress<int>.Default);

            Assert.Equal(1, store.Products.Count());
            Assert.NotNull(store.Products.First().Schema);
            Assert.Same(store, store.Products.First().Store);
        }
Пример #2
0
        public void when_loaded_product_deleted_then_removes_from_store_and_resets_store()
        {
            var store = new ProductStore(
                "ProductStoreFixture.Simple.json",
                new JsonProductSerializer(),
                Mock.Of<IToolkitCatalog>());

            store.Load(NullProgress<int>.Default);

            var product = store.Products.First();

            product.Delete();

            Assert.Equal(0, store.Products.Count());
            Assert.Null(product.Store);
        }