Esempio n. 1
0
    public SpaceDocument createDocumemt()
    {
        DocumentProperties properties = new DocumentProperties();

        properties ["CatalogNumber"] = "av-9876";
        properties["Category"]       = "Aviation";
        properties["Name"]           = "Jet Propelled Pogo Stick";
        properties["Price"]          = 19.99;
        properties["Tags"]           = new String[4] {
            "New", "Cool", "Pogo", "Jet"
        };

        DocumentProperties p2 = new DocumentProperties();

        p2["Manufacturer"]     = "Acme";
        p2["RequiresAssembly"] = true;
        p2["NumberOfParts"]    = 42;
        properties["Features"] = p2;

        SpaceDocument document = new SpaceDocument("Product", properties);

        proxy.Write(document);

        return(document);
    }
Esempio n. 2
0
    public SpaceDocument readProductByTemplate()
    {
        SpaceDocument template = new SpaceDocument("Product");

        template["Name"] = "Jet Propelled Pogo Stick";
        return(proxy.Read <SpaceDocument>(template));
    }
Esempio n. 3
0
    public void createDocumemt()
    {
        service.registerProductType();

        service.createDocumemt();

        SpaceDocument doc = proxy.Read <SpaceDocument>(new SpaceDocument("Product"));

        Assert.IsNotNull(doc);
    }
Esempio n. 4
0
    public SpaceDocument createDocumemt()
    {
        DocumentProperties properties = new DocumentProperties ();

        properties ["CatalogNumber"] = "av-9876";
        properties["Category"]= "Aviation";
        properties["Name"] = "Jet Propelled Pogo Stick";
        properties["Price"]= 19.99;
        properties["Tags"]= new String[4] {"New", "Cool", "Pogo", "Jet"};

        DocumentProperties p2 = new DocumentProperties();
        p2["Manufacturer"]="Acme";
        p2["RequiresAssembly"]=true;
        p2["NumberOfParts"]= 42;
        properties["Features"]=p2;

        SpaceDocument document = new SpaceDocument("Product", properties);
        proxy.Write(document);

        return document;
    }
Esempio n. 5
0
        public void CreateSpaceDocument()
        {
            using (var spaceProxy = new SpaceProxyFactory(SpaceName).Create())
            {
                var document = CreateDocumemt();
                RegisterProductTypeAt(spaceProxy);

                spaceProxy.Write(document);

                SpaceDocument template = new SpaceDocument(SpaceDocument_Product);

                template[Product.Properties.CatalogNumber] = "av-9876";

                var readDocumentFromSpace = spaceProxy.Read(template);

                readDocumentFromSpace.Should().NotBeNull();
                Assert.IsTrue(Equals(readDocumentFromSpace[Product.Properties.Name], "Jet Propelled Pogo Stick"));

                var price = readDocumentFromSpace[Product.Properties.Price];
                price.Should().Be(19.99);
            }

            // Local Helpers
            SpaceDocument CreateDocumemt()
            {
                DocumentProperties properties = new DocumentProperties();

                properties[Product.Properties.CatalogNumber] = "av-9876";
                properties[Product.Properties.Category]      = "Aviation";
                properties[Product.Properties.Name]          = "Jet Propelled Pogo Stick";
                properties[Product.Properties.Price]         = 19.99;
                properties[Product.Properties.Tags]          = new String[4] {
                    "New", "Cool", "Pogo", "Jet"
                };

                DocumentProperties p2 = new DocumentProperties();

                p2[Product.Feature.Properties.Manufacturer]     = "Acme";
                p2[Product.Feature.Properties.RequiresAssembly] = true;
                p2[Product.Feature.Properties.NumberOfParts]    = 42;
                properties[Product.Feature.ClassName]           = p2;

                SpaceDocument document = new SpaceDocument(Product.ClassName, properties);

                return(document);
            }

            void RegisterProductTypeAt(ISpaceProxy proxy)
            {
                // Create type Document descriptor:
                SpaceTypeDescriptorBuilder typeBuilder = new SpaceTypeDescriptorBuilder(Product.ClassName);

                typeBuilder.SetIdProperty(Product.Properties.CatalogNumber);
                typeBuilder.SetRoutingProperty(Product.Properties.Category);
                typeBuilder.AddPathIndex(Product.Properties.Name);
                typeBuilder.AddPathIndex(Product.Properties.Price, SpaceIndexType.Extended);
                ISpaceTypeDescriptor typeDescriptor = typeBuilder.Create();

                // Register type:
                proxy.TypeManager.RegisterTypeDescriptor(typeDescriptor);
            }
        }
Esempio n. 6
0
 public SpaceDocument readProductByTemplate()
 {
     SpaceDocument template = new SpaceDocument("Product");
     template["Name"]= "Jet Propelled Pogo Stick";
     return proxy.Read<SpaceDocument>(template);
 }
Esempio n. 7
0
    public void readProductByTemplate()
    {
        SpaceDocument doc = queryService.readProductByTemplate();

        Assert.IsNotNull(doc);
    }