Пример #1
0
        public void TestReadNotModifiedPerson()
        {
            var result = collection.AddPerson(TestBacking.GetCreateMalePerson());
            Assert.AreEqual(HttpStatusCode.Created, result.Response.StatusCode);
            var person = (PersonState)result.Get();
            var state = collection.ReadPerson(new Uri(READ_PERSON_URI_NO_ID + person.Person.Id));

            //var state = collection.ReadPerson(new Uri(READ_PERSON_URI));
            var cache = new CacheDirectives(state);
            var state2 = collection.ReadPerson(new Uri(READ_PERSON_URI_NO_ID + person.Person.Id), cache);

            //var state2 = collection.ReadPerson(new Uri(READ_PERSON_URI), cache);

            Assert.AreEqual(HttpStatusCode.OK, state.Response.StatusCode);
            Assert.DoesNotThrow(() => state2.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.NotModified, state2.Response.StatusCode);
            result.Delete();
        }
Пример #2
0
 public void TestReadNotModifiedPerson()
 {
     var state = (PersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();
     cleanup.Add(state);
     var cache = new CacheDirectives(state);
     var state2 = tree.ReadPerson(new Uri(state.GetSelfUri()), cache);
     Assert.DoesNotThrow(() => state2.IfSuccessful());
     Assert.AreEqual(HttpStatusCode.NotModified, state2.Response.StatusCode);
 }
Пример #3
0
        public void TestReadCoupleRelationshipConditional()
        {
            var husband = (PersonState)tree.AddPerson(TestBacking.GetCreateMalePerson()).Get();
            var wife = tree.AddPerson(TestBacking.GetCreateFemalePerson());
            var relationship = husband.AddSpouse(wife);
            var @get = (RelationshipState)relationship.Get();
            var cache = new CacheDirectives(@get.LastModified);
            var state = relationship.Get(cache);

            Assert.DoesNotThrow(() => state.IfSuccessful());
            Assert.AreEqual(HttpStatusCode.NotModified, state.Response.StatusCode);
            Assert.AreEqual(HttpStatusCode.OK, husband.Response.StatusCode);
            Assert.AreEqual(HttpStatusCode.Created, wife.Response.StatusCode);
            Assert.AreEqual(HttpStatusCode.Created, relationship.Response.StatusCode);
            Assert.AreEqual(HttpStatusCode.OK, @get.Response.StatusCode);
            wife.Delete();
            husband.Delete();
        }