Beispiel #1
0
        public IGenerateAction InitalizeSelection(CodeGenerationOptions options, Gtk.TreeView treeView)
        {
            CreateProperty createProperty = new CreateProperty(options);

            createProperty.Initialize(treeView);
            return(createProperty);
        }
Beispiel #2
0
        public async Task UpdateRoom_WhenNonExistingRoom_ReturnsNotFound(CreateProperty property, UpdateRoom room)
        {
            var propertyResponse = await CreateProperty(property);

            var response = await UpdateRoom(propertyResponse.Property.Id, 111111, room);

            Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);;
        }
Beispiel #3
0
        public async Task CreateRoom_WhenExistingProperty_ShoudCreateRoom(CreateProperty property, CreateRoom room)
        {
            var propertyResponse = await CreateProperty(property);

            var response = await CreateRoom(propertyResponse.Property.Id, room);

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            Assert.AreEqual(room.NrOfOccupants, response.Room.NrOfOccupants);
            Assert.AreEqual(room.AccommodationType, response.Room.AccommodationType);
        }
        public void TestAssignment()
        {
            CreateProperty cp = new CreateProperty();

            cp.Value = new string [1] {
                "1"
            };

            Assert.AreEqual("1", cp.Value [0], "A1");
            Assert.AreEqual("1", cp.ValueSetByTask [0], "A2");
        }
Beispiel #5
0
        public async Task UpdateRoom_WhenValidDetails_ShouldUpdateRoom(CreateProperty property, CreateRoom room, UpdateRoom updateRoom)
        {
            var propertyResponse = await CreateProperty(property);

            var response = await CreateRoom(propertyResponse.Property.Id, room);

            updateRoom.AccommodationType = response.Room.AccommodationType;
            updateRoom.NrOfOccupants     = response.Room.NrOfOccupants;

            var updateRoomResponse = await UpdateRoom(propertyResponse.Property.Id, response.Room.Id, updateRoom);

            Assert.AreEqual(HttpStatusCode.OK, updateRoomResponse.StatusCode);
            Assert.AreEqual(updateRoom.NrOfOccupants, updateRoomResponse.Room.NrOfOccupants);
            Assert.AreEqual(updateRoom.AccommodationType, updateRoomResponse.Room.AccommodationType);
        }
Beispiel #6
0
        public async Task UpdateProperty_WhenUpdatingName_ShouldUpdateProperty(CreateProperty property)
        {
            var createPropertyResponse = await CreateProperty(property);

            var updateProperty = new UpdateProperty()
            {
                Name = "Some updated name"
            };

            var response = await UpdateProperty(createPropertyResponse.Property.Id, updateProperty);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
            Assert.IsNotNull(response.Property);
            Assert.AreEqual(updateProperty.Name, response.Property.Name);
            Assert.AreEqual(createPropertyResponse.Property.Type, response.Property.Type);
        }
		public IGenerateAction InitalizeSelection (CodeGenerationOptions options, Gtk.TreeView treeView)
		{
			CreateProperty createProperty = new CreateProperty (options);
			createProperty.Initialize (treeView);
			return createProperty;
		}
Beispiel #8
0
        public async Task CreateProperty_WhenProvidingAllValidDetails_ShouldCreateProperty(CreateProperty property)
        {
            var response = await CreateProperty(property);

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            Assert.IsNotNull(response.Property);
            Assert.AreEqual(property.Name, response.Property.Name);
            Assert.AreEqual(property.Type, response.Property.Type);
        }
 public void setCreaterFor(PropertyID pid, CreateProperty creater)
 {
     if (pid == null)
         ArgumentNull.Throw("pid");
     if (creater == null)
         ArgumentNull.Throw("creater");
     creaters.Add(pid, creater);
 }
        public async Task <(Property Property, HttpStatusCode StatusCode)> CreateProperty(CreateProperty property)
        {
            using (var content = new StringContent(JsonConvert.SerializeObject(property), Encoding.UTF8, "application/json"))
            {
                var response = await Client.PostAsync($"properties/", content);

                return(SerializationHelpers.GetEntityFromStream <Property>(await response.Content.ReadAsStreamAsync()), response.StatusCode);
            }
        }