示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
 public string AddLease(DateTime startDate, DateTime endDate, int slipID, int customerID, int leaseTypeID)
 {
     return(LeaseManager.AddLease(startDate, endDate, slipID, customerID, leaseTypeID));
 }