public void ShouldAcceptNewProfile() { const string name = "test"; var evnt = new EventHelper(() => { view.Confirm += null; }); var profile = new Profile {Name = name}; manager.Stub(x => x.ContainsProfile(name)).Repeat.Once().Return(false); manager.Stub(x => x.GetBrowsersNames()).Repeat.Once().Return(browsers); view.Stub(x => x.ShowError(new[] {""})).IgnoreArguments().Repeat.Never(); mocks.ReplayAll(); var controller = new ProfileController(); controller.SetView(view); controller.SetManager(manager); controller.SetProfile(profile, true); evnt.Raise(); }
public void ShouldMergeInterfacesFromProfileAndModel() { var allNames = new[] {"if1","if2","if3"}; var evnt = new EventHelper(() => { manager.DataLoaded += null; }); var ifs = new List<NetworkInterfaceSettings> { new NetworkInterfaceSettings { Name = allNames[0] }, new NetworkInterfaceSettings { Name = allNames[2] } }; var profile = new Profile(); profile.Connections = new ProfileNetworkSettingsList { new ProfileNetworkSettings { Settings = new NetworkInterfaceSettings { Name = allNames[1] } }, new ProfileNetworkSettings { Settings = new NetworkInterfaceSettings { Name = allNames[2] } }}; manager.Stub(x => x.IsIFLoaded()).Return(false); manager.Stub(x => x.GetNetworkInterfaceSettings()).Return(ifs); manager.Stub(x => x.GetBrowsersNames()).Repeat.Once().Return(browsers); mocks.ReplayAll(); var controller = new ProfileController(); controller.SetView(view); controller.SetManager(manager); controller.SetProfile(profile, false); evnt.Raise(); Assert.AreEqual(3,profile.Connections.GetNetworkInterfaceNames().Count); }