public async void KeepLeaseWithMatch_Expect_RequestAccepted() { var leaseRepo = new LeaseRepo(DbConfig); var leaseManager = new LeaseManager(DhcpFakes.FakeDhcpConfiguration(), leaseRepo); var ipAddress = IPAddress.Parse("10.10.10.10"); var hostName = "myserver.local"; var physicalAddress = PhysicalAddress.Parse("000000000000"); await leaseManager.AddLease(ipAddress, physicalAddress, hostName).ConfigureAwait(false); var keepLeaseResponse = await leaseManager.KeepLeaseRequest(ipAddress, physicalAddress, hostName).ConfigureAwait(false); Assert.True(keepLeaseResponse); }
public async void AddLease_Expect_LeaseInDb() { var leaseRepo = new LeaseRepo(DbConfig); var leaseManager = new LeaseManager(DhcpFakes.FakeDhcpConfiguration(), leaseRepo); var ipAddress = IPAddress.Parse("10.10.10.10"); var hostName = "myserver.local"; var physicalAddress = PhysicalAddress.Parse("000000000000"); await leaseManager.AddLease(ipAddress, physicalAddress, hostName).ConfigureAwait(false); var entity = await leaseRepo.GetByIpAddress(ipAddress).ConfigureAwait(false); Assert.Equal(ipAddress.ToString(), entity.IpAddress); Assert.Equal(physicalAddress.ToString(), entity.PhysicalAddress); Assert.Equal(hostName, entity.HostName); }
public async void RemoveLease_Expect_NoLeaseInDb() { var leaseRepo = new LeaseRepo(DbConfig); var leaseManager = new LeaseManager(DhcpFakes.FakeDhcpConfiguration(), leaseRepo); var ipAddress = IPAddress.Parse("10.10.10.10"); var hostName = "myserver.local"; var physicalAddress = PhysicalAddress.Parse("000000000000"); await leaseManager.AddLease(ipAddress, physicalAddress, hostName).ConfigureAwait(false); await leaseManager.RemoveLease(ipAddress).ConfigureAwait(false); var entity = await leaseRepo.GetByIpAddress(ipAddress).ConfigureAwait(false); Assert.Null(entity); }
public string AddLease(DateTime startDate, DateTime endDate, int slipID, int customerID, int leaseTypeID) { return(LeaseManager.AddLease(startDate, endDate, slipID, customerID, leaseTypeID)); }