public void DetachComputerTest() { //Create computer with fake ip-address; Computer computer = new Computer { Banned = false, IpAddress = "999.999.999.999" }; Room room = new Room { Name = "Some room", Id = "Some room".GetHashCode() }; //At the moment of developing this test attach method ( public void Attach(object entity) ) wasn't implemented; try { BanStorage.AttachComputerToRoom(computer, room); } catch (NotImplementedException) { } //public void Attach(object entity, bool asModified) wasn't implemented; try { BanStorage.DetachComputer(computer); } catch (NotImplementedException) { } Assert.True(computer.Room == null); Assert.False(room.Computers.Contains(computer)); }
public void UnbanRoom(Room room) { this.storage.UnbanRoom(room); //REDO var computers = this.storage.GetComputers().Select(s => "computer-" + s.IpAddress); this.cachePrvoider.Invalidate(computers.ToArray()); this.cachePrvoider.Invalidate("computers", "room-" + room.Name, "rooms"); }
public void CreateRoom() { var room = new Room { Id = 1, Name = "tester", Allowed = true }; BanStorage.CreateRoom(room); Assert.AreEqual(2, BanStorage.GetRooms().Count()); }
public void DeleteRoomTest() { Room room = new Room { Name = "Some room 1", Id = "Some room 1".GetHashCode() }; BanStorage.CreateRoom(room); BanStorage.DeleteRoom(room); Assert.False(BanStorage.GetRooms().Contains(room)); }
public void CreateRoomTest() { Room room = new Room { Name = "Some room", Id = "Some room".GetHashCode() }; BanStorage.CreateRoom(room); Assert.True(BanStorage.GetRooms().Contains(room)); }
public void UnbanRoomTest() { Room room = new Room { Name = "Some Room", Id = "Some Room".GetHashCode(), Allowed = false }; BanStorage.CreateRoom(room); //Create computers with fake ip-address; Computer computer1 = new Computer { Banned = true, IpAddress = "999.999.999.998" }; //At the moment of developing this test attach method wasn't implemented; try { BanStorage.AttachComputerToRoom(computer1, room); } catch (NotImplementedException) { } BanStorage.UnbanRoom(room); Assert.True(BanStorage.GetRoom(room.Name).Allowed); Assert.True(room.Allowed); //Check if computers in this room are banned; //The testing method failed at this place; // Assert.True(BanStorage.GetRoom(room.Name).Computers.All(c => c.Banned == false)); }
public void BanRoomTest() { //Create computers with fake ip-address; Computer computer1 = new Computer { Banned = false, IpAddress = "999.999.999.997" }; Computer computer2 = new Computer { Banned = true, IpAddress = "888.888.888.888" }; Room room = new Room { Name = "Some room", Id = "Some room".GetHashCode() }; //At the moment of developing this test attach method wasn't implemented; try { BanStorage.AttachComputerToRoom(computer1, room); BanStorage.AttachComputerToRoom(computer2, room); } catch (NotImplementedException) { } BanStorage.CreateRoom(room); BanStorage.BanRoom(room); Assert.False(BanStorage.GetRoom("Some room").Allowed); Assert.True(BanStorage.GetRoom("Some room").Computers.All(c => c.Banned)); }
public void AttachComputerToRoom(Computer computer, Room room) { this.storage.AttachComputerToRoom(computer, room); this.cachePrvoider.Invalidate("computers", "rooms", "computer-" + computer.IpAddress); }
public IEnumerable<Computer> ComputersAttachedToRoom(Room room) { return this.storage.ComputersAttachedToRoom(room); }
public void DeleteRoom(Room room) { this.storage.DeleteRoom(room); this.cachePrvoider.Invalidate("rooms", "room-" + room.Name); }
public void UnbanRoomTest() { var room = new Room { Name = "Room", Allowed = false }; this.BanStorage.CreateRoom(room); Assert.False(this.BanStorage.GetRoom("Room").Allowed); this.BanStorage.UnbanRoom(room); Assert.True(this.BanStorage.GetRoom("Room").Allowed); }
public void Setup() { this.computer = new Computer { IpAddress = "999.999.999.999", Banned = false }; this.room = new Room { Name = "999", Allowed = true }; }
partial void DeleteRoom(Room instance);
partial void UpdateRoom(Room instance);
partial void InsertRoom(Room instance);