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 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 UnbanComputerTest() { //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" }; BanStorage.CreateComputer(computer1); BanStorage.CreateComputer(computer2); BanStorage.BanComputer(computer1); BanStorage.UnbanComputer(computer1); Assert.False(computer1.Banned); //Check if computer was marked as unbaned in BanStorage; Assert.False(BanStorage.GetComputers().First(c => c.IpAddress == computer1.IpAddress).Banned); BanStorage.UnbanComputer(computer2); Assert.False(computer2.Banned); }
public void BanComputerTest() { //Create computer with fake ip-address; Computer computer = new Computer { Banned = false, IpAddress = "999.999.999.999" }; BanStorage.CreateComputer(computer); BanStorage.BanComputer(computer); Assert.True(computer.Banned); //Check if banned computer is added to BanStorage; Assert.True(BanStorage.GetComputers().SingleOrDefault(c => c.IpAddress == computer.IpAddress).Banned); }
private void detach_Computers(Computer entity) { this.SendPropertyChanging(); entity.Room = null; }
partial void UpdateComputer(Computer instance);
public void ifBannedTest() { //Create computers with fake ip-address; Computer computer1 = new Computer { Banned = true, IpAddress = "999.949.999.979" }; Computer computer2 = new Computer { Banned = false, IpAddress = "969.949.999.979" }; BanStorage.CreateComputer(computer1); BanStorage.CreateComputer(computer2); Assert.True(BanStorage.ifBanned("999.949.999.979")); Assert.False(BanStorage.ifBanned("969.949.999.979")); }
public void UnbanComputer(Computer computer) { this.storage.UnbanComputer(computer); this.cachePrvoider.Invalidate("computers", "computer-" + computer.IpAddress); }
public void DetachComputer(Computer computer) { this.cachePrvoider.Invalidate("computers", "rooms", "computer-" + computer.IpAddress); this.storage.DetachComputer(computer); }
public void AttachComputerToRoom(Computer computer, Room room) { this.storage.AttachComputerToRoom(computer, room); this.cachePrvoider.Invalidate("computers", "rooms", "computer-" + computer.IpAddress); }
public void CreateComputer(Computer computer) { this.storage.CreateComputer(computer); this.cachePrvoider.Invalidate("computer-" + computer.IpAddress, "computers"); }
public RoomAttachment GetAttachment(Computer computer) { return this.storage.GetAttachment(computer); }
public void Setup() { this.computer = new Computer { IpAddress = "999.999.999.999", Banned = false }; this.room = new Room { Name = "999", Allowed = true }; }
partial void DeleteComputer(Computer instance);
public void DeleteComputerTest() { //Create computer with fake ip-address; Computer computer = new Computer { Banned = false, IpAddress = "999.999.999.989" }; BanStorage.CreateComputer(computer); BanStorage.DeleteComputer(computer); Assert.False(BanStorage.GetComputers().Contains(computer)); }
public void GetComputerTest() { //Create computer with fake ip-address; Computer computer = new Computer { Banned = true, IpAddress = "999.949.999.979" }; BanStorage.CreateComputer(computer); Assert.True(BanStorage.GetComputer("999.949.999.979").Banned); }
public Room GetRoom(Computer computer) { return this.storage.GetRoom(computer); }
private void attach_Computers(Computer entity) { this.SendPropertyChanging(); entity.Room = this; }
partial void InsertComputer(Computer instance);