Ejemplo n.º 1
0
        public void ShouldFailCreatingRoom()
        {
            var input        = new CreateRoomInput(0, "test", RoomType.Call);
            var mockRoomRepo = new Mock <IRoomRepository>();

            mockRoomRepo.Setup(m => m.Create(It.Is <Room>(r => r.Name == "test"))).Returns(0);
            var res = new CreateRoom(mockRoomRepo.Object, input).Execute();

            Assert.AreEqual(0, res);
        }
Ejemplo n.º 2
0
        public IActionResult Create([FromBody] CreateRoomInput room)
        {
            var res = new CreateRoom(Repository, room).Execute();

            if (res == -1)
            {
                return(Conflict());
            }
            return(Ok(res));
        }
        /// <summary>
        /// Allows creation of a new datacenter room object
        ///
        /// <para>
        /// A datacenter room record allows customers to logically organize their
        /// infrastructure by physical location.
        /// </para>
        /// </summary>
        /// <param name="dataCenterGuid">
        /// Unique identifier for the parent datacenter
        /// </param>
        /// <param name="name">
        /// Name for the new datacenter room
        /// </param>
        /// <param name="note">
        /// An optional note for the new datacenter room
        /// </param>
        /// <param name="location">
        /// An optional location for the new datacenter room
        /// </param>
        /// <returns>The new datacenter room</returns>
        public Room CreateRoom(
            Guid dataCenterGuid,
            string name,
            string note     = null,
            string location = null)
        {
            // setup room input
            CreateRoomInput input = new CreateRoomInput
            {
                DataCenterGuid = dataCenterGuid,
                Name           = name,
                Note           = note,
                Location       = location
            };

            // setup parameters
            GraphQLParameters parameters = new GraphQLParameters();

            parameters.Add("input", input, false);

            return(RunMutation <Room>(@"createLab", parameters));
        }
Ejemplo n.º 4
0
 public CreateRoom(IRoomRepository roomRepository, CreateRoomInput input)
 {
     this.roomRepository = roomRepository;
     Input = input;
 }