public async Task BuildAdd()
        {
            var mocks = new ItemMvcBuilderMocks <Uom>();

            Setup(mocks);
            var builder = BuildBuilder <Uom>(mocks);
            await builder.BuildAddAsync(mocks.LrpNavigation.Object);
        }
        public async Task BuildEdit()
        {
            var uom   = new Uom();
            var mocks = new ItemMvcBuilderMocks <Uom>();

            Setup(mocks, uom);
            var builder = BuildBuilder <Uom>(mocks);
            await builder.BuildEditAsync(mocks.LrpNavigation.Object, uom);
        }
 public ItemMvcBuilder <TItem> BuildBuilder <TItem>(ItemMvcBuilderMocks <TItem> mocks)
     where TItem : class, IEntity
 {
     return(new ItemMvcBuilder <TItem>
            (
                mocks.CreateItemViewModel.Object,
                mocks.CreateItemPage.Object,
                mocks.CreateItemPageController.Object
            ));
 }
 public void Setup <TItem>(ItemMvcBuilderMocks <TItem> mocks, TItem item = null)
     where TItem : class, IEntity
 {
     mocks.CreateItemViewModel.Setup(f => f()).Returns(mocks.ItemViewModel.Object);
     mocks.ItemPage.Setup(i => i.InitializePage());
     mocks.ItemPage.SetupSet(i => i.BindingContext = mocks.ItemViewModel.Object);
     mocks.CreateItemPage.Setup(f => f()).Returns(mocks.ItemPage.Object);
     mocks.LrpNavigation.Setup(n => n.PushAsync(mocks.ItemPage.Object as ContentPage)).Returns(Task.CompletedTask);
     if (item != null)
     {
         mocks.ItemPageController.Setup(c => c.InitializeEditAsync(item)).Returns(Task.CompletedTask);
     }
     else
     {
         mocks.ItemPageController.Setup(c => c.InitializeAddAsync()).Returns(Task.CompletedTask);
     }
     mocks.CreateItemPageController.Setup(f => f(mocks.LrpNavigation.Object, mocks.ItemViewModel.Object, mocks.ItemPage.Object)).Returns(mocks.ItemPageController.Object);
 }