Exemple #1
0
        public async void KeepLeaseWithNoMatch_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");

            bool keepLeaseResponse = await leaseManager.KeepLeaseRequest(ipAddress, physicalAddress, hostName).ConfigureAwait(false);

            Assert.True(keepLeaseResponse);
        }
Exemple #2
0
        public async void KeepLeaseWithMatch_WrongMAC_Expect_RequestRejected()
        {
            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");
            var physicalAddress2 = PhysicalAddress.Parse("999999999999");

            await leaseManager.AddLease(ipAddress, physicalAddress, hostName).ConfigureAwait(false);

            var keepLeaseResponse = await leaseManager.KeepLeaseRequest(ipAddress, physicalAddress2, hostName).ConfigureAwait(false);

            Assert.False(keepLeaseResponse);
        }