public void Create() { var context = new Mock <IContextAware>(); var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var proposal = new DatasetActivationProposal { PercentageOfAvailableDisk = 5, PercentageOfMaximumMemory = 100, PercentageOfPhysicalMemory = 75, TransferTime = new TimeSpan(0, 0, 1, 0, 0), ActivationTime = new TimeSpan(0, 0, 0, 1, 0), }; var plan = CreateNewDistributionPlan( proposal, CreateOfflineInfo(new Mock <IPersistenceInformation>().Object), systemDiagnostics); var suggestion = new DistributionSuggestion(plan); var parameter = new MachineSelectorParameter( context.Object, new List <DistributionSuggestion> { suggestion, }); Assert.That( parameter.Suggestions, Is.EquivalentTo( new List <DistributionSuggestion> { suggestion, })); }
public void Initialize() { var context = new Mock <IContextAware>(); var view = new Mock <IMachineSelectorView>(); { view.SetupSet(v => v.Model = It.IsAny <MachineSelectorModel>()) .Verifiable(); } var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var plan = CreateNewDistributionPlan( new DatasetActivationProposal(), CreateOfflineInfo(new Mock <IPersistenceInformation>().Object), systemDiagnostics); var suggestion = new DistributionSuggestion(plan); var parameter = new MachineSelectorParameter( context.Object, new List <DistributionSuggestion> { suggestion, }); var container = new Mock <IDependencyInjectionProxy>(); { container.Setup(c => c.Resolve <IContextAware>()) .Returns(context.Object); } var presenter = new MachineSelectorPresenter(container.Object); ((IPresenter)presenter).Initialize(view.Object, parameter); Assert.AreSame(view.Object, presenter.View); Assert.AreSame(parameter, presenter.Parameter); view.VerifySet(v => v.Model = It.IsAny <MachineSelectorModel>(), Times.Once()); }
public void Initialize() { var context = new Mock<IContextAware>(); var view = new Mock<IMachineSelectorView>(); { view.SetupSet(v => v.Model = It.IsAny<MachineSelectorModel>()) .Verifiable(); } var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var plan = CreateNewDistributionPlan( new DatasetActivationProposal(), CreateOfflineInfo(new Mock<IPersistenceInformation>().Object), systemDiagnostics); var suggestion = new DistributionSuggestion(plan); var parameter = new MachineSelectorParameter( context.Object, new List<DistributionSuggestion> { suggestion, }); var container = new Mock<IDependencyInjectionProxy>(); { container.Setup(c => c.Resolve<IContextAware>()) .Returns(context.Object); } var presenter = new MachineSelectorPresenter(container.Object); ((IPresenter)presenter).Initialize(view.Object, parameter); Assert.AreSame(view.Object, presenter.View); Assert.AreSame(parameter, presenter.Parameter); view.VerifySet(v => v.Model = It.IsAny<MachineSelectorModel>(), Times.Once()); }