示例#1
0
        public void Delete_cmd_deletes_selected_profile()
        {
            var           profileStore    = new MemProfileStore();
            DeleteProfile del             = new DeleteProfile(profileStore);
            var           existingProfile = profileStore.Retrieve().First();

            del.DeleteProfileByName(existingProfile.Name);
            profileStore.Retrieve().Should().NotContain(existingProfile);
        }
示例#2
0
        public void Add_command_adds_static_profile_with_ip_and_subnet()
        {
            IProfileStore profileStore = new MemProfileStore();
            var           _adder       = new AddProfile(profileStore);

            _adder.AddStaticProfile(testStaticProfile1.Name, testStaticProfile1.IP, testStaticProfile1.Subnet);
            profileStore.Retrieve().Where(p => p.Name == testStaticProfile1.Name).Should().HaveCount(1);
            profileStore.Retrieve().Where(p => p.Name == testStaticProfile1.Name).First().IP.Should().BeEquivalentTo(testStaticProfile1.IP);
            profileStore.Retrieve().Where(p => p.Name == testStaticProfile1.Name).First().Subnet.Should().BeEquivalentTo(testStaticProfile1.Subnet);
        }
示例#3
0
        public void Add_command_adds_dynamic_profile()
        {
            IProfileStore profileStore   = new MemProfileStore();
            var           _adder         = new AddProfile(profileStore);
            int           startingCount  = profileStore.Retrieve().Count();
            string        newProfileName = "add command adds dynamic profile";

            _adder.AddDynamicProfile(newProfileName);

            profileStore.Retrieve().Where(p => p.Name == newProfileName).Should().HaveCount(1);
        }
示例#4
0
        public void Edit_ReplacesProfile_WithUpdatedVersion()
        {
            IProfileStore profileStore = new MemProfileStore();
            var           editor       = new EditProfile(profileStore)
            {
                IP     = IPAddress.Parse("192.168.47.99"),
                Subnet = IPAddress.Parse("255.0.0.0")
            };

            editor.Edit("static 1");
            profileStore.Retrieve().Where(p => p.Name == "static 1").First().IP.Should().Be(IPAddress.Parse("192.168.47.99"));
            profileStore.Retrieve().Where(p => p.Name == "static 1").First().Subnet.Should().Be(IPAddress.Parse("255.0.0.0"));
        }
示例#5
0
        public void Selected_profile_is_applied_to_default_nic()
        {
            var memStore = new MemProfileStore();
            var applier  = new ApplierMock();
            var settings = new FakeSettings();

            UseProfile use = new UseProfile(memStore, applier, settings);

            var rng             = new System.Random();
            var selectedProfile = memStore.Retrieve().ToList().OrderBy(p => rng.Next()).First();

            use.UseProfileByName(selectedProfile.Name);

            applier.LastAppliedProfile.Should().BeEquivalentTo(selectedProfile);
            applier.LastAppliedInterface.Should().BeEquivalentTo(settings.DefaultNIC);
        }