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 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 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 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 AttachComputerToRoom() { var computer = BanStorage.GetComputers().First(); var room = BanStorage.GetRooms().First(); BanStorage.AttachComputerToRoom(computer, room); Assert.AreEqual(room.Id, computer.Room.Id); }
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 AttachComputerToRoom() { this.BanStorage.CreateComputer(this.computer); this.BanStorage.CreateRoom(this.room); BanStorage.AttachComputerToRoom(this.computer, this.room); Assert.AreEqual(this.BanStorage.ComputersAttachedToRoom(this.room).Contains(this.computer), true); }
public void AttachComputerToRoom() { var computer = this.BanStorage.GetComputers().First(); var room = this.BanStorage.GetRooms().First(); BanStorage.AttachComputerToRoom(computer, room); // computer.RoomRef = room.Id; //REDO //Assert.AreEqual(room.Id, computer.Room.Id); }
public void CreateComputerTest() { //Create computer with fake ip-address; Computer computer = new Computer { Banned = false, IpAddress = "999.999.999.999" }; BanStorage.CreateComputer(computer); Assert.True(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 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 CreateRoom() { var room = new Room { Id = 1, Name = "tester", Allowed = true }; BanStorage.CreateRoom(room); Assert.AreEqual(2, BanStorage.GetRooms().Count()); }
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); }
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 CreateComputer() { BanStorage.CreateComputer(new Computer()); Assert.AreEqual(2, BanStorage.GetComputers().Count()); }