public void MainVmTest_AddBookingTest()
        {
            //Setup Mocks
            var booking = new Mock<IBookingService>();
            booking.Setup(foo => foo.AddBookingAsync(It.IsAny<Booking>(), It.IsAny<Action<Booking>>(), It.IsAny<Action<Exception>>()));
            booking.Setup(foo => foo.GetBookingsAsync(It.IsAny<DateTime>(), It.IsAny<Action<IEnumerable<Booking>>>(), It.IsAny<Action<Exception>>()))
                .Callback<DateTime, Action<IEnumerable<Booking>>, Action<Exception>>((t, s, e) =>
                {
                    s(new[] { new Booking() { ClientName = "Test", Duration = 15, Id = 5 } });
                });

            var mbox = new Mock<IMessageBoxService>();
            mbox.Setup(foo => foo.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxButton>(), It.IsAny<MessageBoxImage>()));

            var config = new Mock<IConfigService>();
            config.Setup(foo => foo.GetAvailableDurations()).Returns(new[] { 15, 30, 45, 60 });

            //Create VM with Mocks
            var vm = new MainWindowViewModel(booking.Object, mbox.Object, config.Object);

            var date = DateTime.Now;
            vm.AddNewCommand.Execute(date);

            //Check Defaults
            Assert.IsTrue(vm.BookingVm.AvailableDurations.All(a => new[] { 15, 30, 45, 60 }.Contains(a)), "Default Durations are not set");
            Assert.IsTrue(vm.BookingVm.IsAddMode, "VM Should be in Add mode");
            Assert.AreEqual(date, vm.BookingVm.BookingDate, "Date is not set correctly");
            Assert.AreEqual(date.ToShortTimeString(), vm.BookingVm.BookingTime, "Time is not set correctly");

            booking.Setup(foo => foo.AddBookingAsync(It.IsAny<Booking>(), It.IsAny<Action<Booking>>(), It.IsAny<Action<Exception>>()))
                .Callback<Booking, Action<Booking>, Action<Exception>>((b, s, e) =>
                {
                    b.Id = 9;
                    s(b);
                });
            vm.BookingVm.Model.ClientName = "Unit Test 2";
            vm.BookingVm.Model.Duration = 60;

            vm.BookingVm.SubmitCommand.Execute(null);

            Assert.AreEqual(2, vm.Bookings.Count, "Should have just added booking");
            Assert.AreEqual("Unit Test 2", vm.Bookings.Single(a => a.Id == 9).ClientName, "ClientName does not match");
            Assert.AreEqual(60, vm.Bookings.Single(a => a.Id == 9).Duration, "Duration does not match");
            Assert.AreEqual(date, vm.Bookings.Single(a => a.Id == 9).Slot, "Slot does not match");
        }
        public void MainVmTest_GetBookingTest()
        {
            //Setup Mocks
            var booking = new Mock<IBookingService>();
            booking.Setup(foo => foo.AddBookingAsync(It.IsAny<Booking>(), It.IsAny<Action<Booking>>(), It.IsAny<Action<Exception>>()));
            booking.Setup(foo => foo.GetBookingsAsync(It.IsAny<DateTime>(), It.IsAny<Action<IEnumerable<Booking>>>(), It.IsAny<Action<Exception>>()))
                .Callback<DateTime, Action<IEnumerable<Booking>>, Action<Exception>>((t, s, e) =>
                    {
                        s(new[] { new Booking() { ClientName = "Test", Duration = 15, Id = 5 } });
                    });

            var mbox = new Mock<IMessageBoxService>();
            mbox.Setup(foo => foo.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxButton>(), It.IsAny<MessageBoxImage>()));

            var config = new Mock<IConfigService>();
            config.Setup(foo => foo.GetAvailableDurations()).Returns(new[] { 15, 30, 45, 60 });

            //Create VM with Mocks
            var vm = new MainWindowViewModel(booking.Object, mbox.Object, config.Object);

            booking.Verify(a => a.GetBookingsAsync(It.IsAny<DateTime>(), It.IsAny<Action<IEnumerable<Booking>>>(), It.IsAny<Action<Exception>>()), Times.Once());

            Assert.IsTrue(vm.Bookings.Any(), "Booking should have a booking");
            Assert.AreEqual("Test", vm.Bookings.First().ClientName, "Booking ClientName does not match");
            Assert.AreEqual(15, vm.Bookings.First().Duration, "Booking Duration does not match");
            Assert.AreEqual(5, vm.Bookings.First().Id, "Booking Id does not match");
        }