Ejemplo n.º 1
0
        public async Task TryRemoveReservationFromShowAsync()
        {
            var stateManager = new MockReliableStateManager();
            var showService  = new ShowService(TestUtils.StatefulServiceContext, stateManager);

            var showId = new ItemId(new Guid("936DA01F-9ABD-4D9D-80C7-02AF85C822A8"));
            await showService.AddAsync(new ShowItem
            {
                Id = showId,
                MaxReservations = 50,
                Movie           = "Bucks Bunny",
                ShowDateTime    = new DateTime(2010, 10, 10, 10, 10, 10)
            });

            var reservation = new Reservation.Domain.ReservationItem
            {
                ReservationDateTime = new DateTime(2010, 10, 10, 9, 10, 10),
                ShowItemId          = showId
            };
            await showService.TryAddReservationToShowAsync(reservation);

            var result = await showService.TryRemoveReservationFromShowAsync(reservation);

            Assert.IsTrue(result);
            Assert.IsTrue(!(await showService.GetByIdAsync(showId)).Reservations.Any());
        }
Ejemplo n.º 2
0
        public async Task TryAddReservationToShowTest()
        {
            var stateManager = new MockReliableStateManager();
            var showService  = new ShowService(TestUtils.StatefulServiceContext, stateManager);

            var showId = new ItemId(new Guid("936DA01F-9ABD-4D9D-80C7-02AF85C822A8"));

            await showService.AddAsync(new ShowItem
            {
                Id = showId,
                MaxReservations = 50,
                Movie           = "Bucks Bunny",
                ShowDateTime    = new DateTime(2010, 10, 10, 10, 10, 10)
            });

            var reservation = new Reservation.Domain.ReservationItem
            {
                ReservationDateTime = new DateTime(2010, 10, 10, 9, 10, 10),
                ShowItemId          = showId
            };
            var success = await showService.TryAddReservationToShowAsync(reservation);


            Assert.IsTrue(success);
            var added = (await showService.GetByIdAsync(showId)).Reservations.First();

            Assert.AreEqual(added.Key, reservation.Id);
        }
Ejemplo n.º 3
0
        public async Task AddShowTest()
        {
            var stateManager = new MockReliableStateManager();
            var ShowService  = new ShowService(TestUtils.StatefulServiceContext, stateManager);
            var item         = new ShowItem();

            var result = await ShowService.GetByIdAsync(item.Id);

            Assert.AreEqual(null, result);

            var addResult = await ShowService.AddAsync(item);

            Assert.IsTrue(addResult);

            result = await ShowService.GetByIdAsync(item.Id);

            Assert.AreEqual(item, result);
        }