Example #1
0
        public void Check_RegisterNullViewModel()
        {
            var fakeOwner            = A.Fake <IControl>();
            var viewServiceContainer = new ViewServiceContainer(fakeOwner);

            var compositeDisposable = new CompositeDisposable();

            viewServiceContainer.StartObserving(compositeDisposable, null);

            Assert.IsTrue(compositeDisposable.Count == 1);
            Assert.IsTrue(viewServiceContainer.IsObserving);
        }
Example #2
0
        public void Check_RegisterNullViewModel_WithViewService()
        {
            var fakeOwner            = A.Fake <IControl>();
            var viewServiceContainer = new ViewServiceContainer(fakeOwner);
            var fakeViewService1     = A.Fake <IViewService>();
            var fakeViewService2     = A.Fake <IViewService>();

            viewServiceContainer.ViewServices.Add(fakeViewService1);

            var compositeDisposable = new CompositeDisposable();

            viewServiceContainer.StartObserving(compositeDisposable, null);

            viewServiceContainer.ViewServices.Add(fakeViewService2);

            Assert.IsTrue(compositeDisposable.Count == 1);
            Assert.IsTrue(viewServiceContainer.IsObserving);
            Assert.IsTrue(Fake.GetCalls(fakeViewService1).Any(actCall => actCall.Method.Name == $"add_{nameof(IViewService.ViewServiceRequest)}"));
            Assert.IsTrue(Fake.GetCalls(fakeViewService2).Any(actCall => actCall.Method.Name == $"add_{nameof(IViewService.ViewServiceRequest)}"));
        }