示例#1
0
        public void Setup()
        {
            xenNetworkInformation = MockRepository.GenerateMock <IXenNetworkInformation>();
            setNetworkInterface   = MockRepository.GenerateMock <ISetNetworkInterface>();
            setNetworkRoutes      = MockRepository.GenerateMock <ISetNetworkRoutes>();

            networkInterface = new NetworkInterface();
            network          = new Network();
            network.Interfaces.Add("fakemac", networkInterface);
            command = new ResetNetwork(setNetworkInterface, xenNetworkInformation, setNetworkRoutes);
            xenNetworkInformation.Stub(x => x.Get()).Return(network);

            result = command.Execute(null);
        }
示例#2
0
        public void should_set_interface_from_interfaceconfigiuration()
        {
            xenNetworkInformation.Stub(x => x.Get()).Return(network);
            xenProviderDataInformation.Stub(x => x.Get()).Return(providerData);
            _xenStore.Stub(x => x.ReadVmData("hostname")).Return(hostname);

            result = command.Execute(null);

            setNetworkInterface.AssertWasCalled(x => x.Execute(new List <NetworkInterface> {
                networkInterface
            }));
            setNetworkRoutes.AssertWasCalled(x => x.Execute(network));
            setProviderData.AssertWasCalled(x => x.Execute(providerData));
            setHostname.AssertWasCalled(x => x.SetHostname(hostname));
        }