Esempio n. 1
0
 protected override bool ExecuteWithData(string cmd, IRepository repo, Player player)
 {
     var name = cmd.Split(new[] { ' ' }, 2)[1];
     var room = new Room()
     {
         Name = name
     };
     repo.Add(room);
     return true;
 }
Esempio n. 2
0
        public void Look_and_RoomName_Should_Return_Desc_of_Room()
        {
            // Arrange
            var hallway = new Room() { RoomName = "Hallway", Description= "It's a hallway." };
            var bar = new Room() { RoomName = "Bar", Description = "I love this bar. It's my kinda of place." };
            var list = new List<Room>() { hallway, bar };
            roomRepository.Stub(qq => qq.AsQueryable()).Return(list.AsQueryable());

            // Act
            cmd.Execute("look hallway");

            // Assert
            mock.AssertWasCalled(qq => qq.WriteLine("It's a hallway."));
            roomRepository.AssertWasCalled(m => m.Dispose());
        }
        public void Execute_Should_Set_the_Description_of_Hallway_to_Its_a_Hallway_Period()
        {
            // Arrange
            var hallway = new Room() { RoomName = "Hallway" };
            var bar = new Room() { RoomName = "Bar" };
            var list = new List<Room>() { hallway, bar };
            repository.Stub(qq => qq.AsQueryable()).Return(list.AsQueryable());

            // Act
            cmd.Execute("place Hallway.desc = It's a hallway.");

            // Assert
            Assert.AreEqual("It's a hallway.", hallway.Description);
            // It's not enough to assert that a DB call was made.
                // How can I assert that a specific field was chosen?
            repository.AssertWasCalled(m => m.Dispose());
        }
Esempio n. 4
0
 /// <summary>
 /// Create a new Room object.
 /// </summary>
 /// <param name="roomId">Initial value of the RoomId property.</param>
 public static Room CreateRoom(global::System.Int32 roomId)
 {
     Room room = new Room();
     room.RoomId = roomId;
     return room;
 }
Esempio n. 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Rooms EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToRooms(Room room)
 {
     base.AddObject("Rooms", room);
 }