Ejemplo n.º 1
0
        public void ShouldReturnErrorResponseCodeIfIdIsUnknown()
        {
            using (var context = new ServerDatabaseContext())
            {
                context.Rooms.Add(new Room {
                    Id = 1, Description = "Room 1"
                });
                context.Rooms.Add(new Room {
                    Id = 2, Description = "Room 2"
                });
                context.Rooms.Add(new Room {
                    Id = 300, Description = "Room 300"
                });
                context.SaveChanges();
            }
            var requestHandler = new GetRoomDescriptionRequestHandler();

            var response = (GetRoomDescriptionDataResponse)requestHandler.Handle(new GetRoomDescriptionDataRequest {
                Identifier = 99
            });

            response.ResponseCode0.Should().Be(0x01);
            response.ResponseCode1.Should().Be(0x00);
            response.Identifier.Should().Be(0);
            response.Description.Should().Be("");
        }
Ejemplo n.º 2
0
        public void ShouldReturnRoomDescriptionForExistingEntry()
        {
            using (var context = new ServerDatabaseContext())
            {
                context.Rooms.Add(new Room {
                    Id = 1, Description = "Room 1"
                });
                context.Rooms.Add(new Room {
                    Id = 2, Description = "Room 2"
                });
                context.Rooms.Add(new Room {
                    Id = 300, Description = "Room 300"
                });
                context.SaveChanges();
            }
            var requestHandler = new GetRoomDescriptionRequestHandler();

            var response = (GetRoomDescriptionDataResponse)requestHandler.Handle(new GetRoomDescriptionDataRequest {
                Identifier = 2
            });

            response.Identifier.Should().Be(2);
            response.Description.Should().Be("Room 2");
        }