Exemplo n.º 1
0
        public void Insert_GivenPocoWithJsonTypes_ShouldBeValid()
        {
            var poco = new JsonTypesPoco();

            var id = DB.Insert(poco);
            var pocoOther = DB.Single<JsonTypesPoco>(poco.Id);

            poco.Id.ShouldBe(id);
            pocoOther.ShouldNotBeNull();
            pocoOther.ShouldBe(poco);
        }
Exemplo n.º 2
0
        public void ShouldBe(JsonTypesPoco other)
        {
            Id.ShouldBe(other.Id);
            dynamic j1 = JObject.Parse(Json1);
            dynamic jo1 = JObject.Parse(other.Json1);
            dynamic j2 = JObject.Parse(Json2);
            dynamic jo2 = JObject.Parse(other.Json2);

            ((string) j1.firstName).ShouldBe((string) jo1.firstName);
            ((string) j1.lastName).ShouldBe((string) jo1.lastName);
            ((string) j2.firstName).ShouldBe((string) jo2.firstName);
            ((string) j2.lastName).ShouldBe((string) jo2.lastName);
        }
Exemplo n.º 3
0
        public void ShouldBe(JsonTypesPoco other)
        {
            Id.ShouldBe(other.Id);
            dynamic j1  = JObject.Parse(Json1);
            dynamic jo1 = JObject.Parse(other.Json1);
            dynamic j2  = JObject.Parse(Json2);
            dynamic jo2 = JObject.Parse(other.Json2);

            ((string)j1.firstName).ShouldBe((string)jo1.firstName);
            ((string)j1.lastName).ShouldBe((string)jo1.lastName);
            ((string)j2.firstName).ShouldBe((string)jo2.firstName);
            ((string)j2.lastName).ShouldBe((string)jo2.lastName);
        }
Exemplo n.º 4
0
        public void Update_GivenPocoWithJsonTypes_ShouldBeValid()
        {
            var poco = new JsonTypesPoco();

            var id = DB.Insert(poco);
            var pocoOther = DB.Single<JsonTypesPoco>(poco.Id);
            pocoOther.Json1 = "{\"firstName\":\"Peta\", \"lastName\":\"Poco\"}";
            pocoOther.Json2 = "{\"firstName\":\"Peta\", \"lastName\":\"Poco\"}";
            DB.Update(pocoOther);

            poco.Id.ShouldBe(id);
            pocoOther.ShouldNotBeNull();
            pocoOther.ShouldNotBe(poco, true);
        }