Exemple #1
0
        void gemini_constructor_that_takes_in_dto()
        {
            before = () =>
            {
                blog = new ExpandoObject();
                blog.Title = "Working With Oak";
                blog.Body = "Oak is tight, yo.";
            };

            context["given that the dynamic blogged is wrapped with a gemini"] = () =>
            {
                before = () =>
                    gemini = new BlogEntry(blog);

                it["base properties are still accessible"] = () =>
                    (gemini.Title as string).should_be("Working With Oak");

                it["base properties are still settable"] = () =>
                {
                    gemini.Title = "Another Title";
                    (blog.Title as string).should_be("Another Title");
                };

                it["new properites provided by BlogEntry gemini are available"] = () =>
                    ((bool)gemini.IsValid()).should_be_true();

                it["properites defined in the gemini override base properties"] = () =>
                    (gemini.Body as string).should_be("");
            };
        }
Exemple #2
0
        void of_kind()
        {
            it["looks at inheritance heirarchy for strongly typed objects"] = () =>
            {
                "foobar".IsOfKind<string>().should_be_true();

                "foobar".IsOfKind<object>().should_be_true();
            };

            it["looks at inheritance heirarchy for gemini's"] = () =>
            {
                dynamic blog = new BlogEntry(new { });

                ((bool)blog.IsOfKind<BlogEntry>()).should_be_true();

                ((bool)blog.IsOfKind<Gemini>()).should_be_true();
            };

            it["includes modules that are mixed in for a gemini instance"] = () =>
            {
                dynamic blog = new BlogEntry(new { });

                blog.Extend<Changes>();

                ((bool)blog.IsOfKind<Changes>()).should_be_true();
            };
        }
Exemple #3
0
        void gemini_constructor_that_takes_in_dto()
        {
            before = () =>
            {
                blog = new Prototype();
                blog.Title = "Working With Oak";
                blog.Body = "Oak is tight, yo.";
                blog.Author = "Amir";
            };

            context["given that the dynamic blog is wrapped with a gemini"] = () =>
            {
                before = () =>
                    gemini = new BlogEntry(blog);

                it["base properties are still accessible"] = () =>
                    (gemini.Title as string).should_be("Working With Oak");

                it["base properties are still settable"] = () =>
                {
                    gemini.Title = "Another Title";
                    (blog.Title as string).should_be("Another Title");
                };

                it["new properites provided by BlogEntry gemini are available"] = () =>
                    ((bool)gemini.IsValid()).should_be_true();

                it["properites defined in the gemini override base properties"] = () =>
                    (gemini.Body as string).should_be("");

                it["auto property is assigned as opposed to creating a new prop on the fly"] = () =>
                    (gemini.Author as string).should_be("Amir");
            };
        }
Exemple #4
0
        void specify_of_type_for_gemini_compares_direct_type()
        {
            dynamic blog = new BlogEntry(new { });

            ((bool)blog.IsOfType<BlogEntry>()).should_be_true();
        }