Esempio n. 1
0
 public Library(IBookDao dao)
 {
     this.catalog      = new CatalogBasicImpl(dao);
     this.processState = new LibraryState(dao);
     this.users        = new UsersBasicImpl();
     this.events       = new EventsBasicImpl();
 }
Esempio n. 2
0
 private void FillRentals(LibraryState state)
 {
     state.BookRentals.Add(new Rental(state.LibraryBooks[1], state.LibraryUsers[4]));
     state.BookRentals.Add(new Rental(state.LibraryBooks[3], state.LibraryUsers[3]));
     state.BookRentals.Add(new Rental(state.LibraryBooks[5], state.LibraryUsers[4]));
     state.BookRentals.Add(new Rental(state.LibraryBooks[0], state.LibraryUsers[1]));
     state.BookRentals.Add(new Rental(state.LibraryBooks[4], state.LibraryUsers[0]));
 }
Esempio n. 3
0
        public LibraryUOW(LibraryState libData, IBookDao bDao, IUsersDao uDao, IRentalDao rDao)
        {
            libraryData = libData;

            booksDao   = bDao;
            usersDao   = uDao;
            rentalsDao = rDao;
        }
Esempio n. 4
0
 private void FillUsers(LibraryState state)
 {
     state.LibraryUsers.Add(new User("Jake", "Nadd"));
     state.LibraryUsers.Add(new User("Jack", "Sparrow"));
     state.LibraryUsers.Add(new User("David", "Hunter"));
     state.LibraryUsers.Add(new User("Freddie", "Mercury"));
     state.LibraryUsers.Add(new User("Khem", "Val"));
 }
        public LibraryDataService()
        {
            LibraryState       libraryState = new LibraryState();
            BookDaoBasicImpl   bookDao      = new BookDaoBasicImpl(libraryState);
            UserDaoBasicImpl   userDao      = new UserDaoBasicImpl(libraryState);
            RentalDaoBasicImpl rentalDao    = new RentalDaoBasicImpl(libraryState);

            libUOW = new LibraryUOW(libraryState, bookDao, userDao, rentalDao);
            FillLibraryDataWithConstants();
        }
Esempio n. 6
0
 public ActionDrawnForLibrary(Card action, LibraryState state, ITurnScope scope) : base(scope)
 {
     Description           = "Take " + action.Name + " into hand, or set it aside?";
     _action               = action;
     GetAvailableResponses = () => new List <IEventResponse>
     {
         new SetAsideActionForLibrary(scope, state, action),
         new TakeActionCardIntoHandForLibrary(scope, state, action)
     };
 }
Esempio n. 7
0
 private void FillBooks(LibraryState state)
 {
     state.LibraryBooks.Add(new Book("The Chemistry of Death", "Simon Beckett", "Crime"));
     state.LibraryBooks.Add(new Book("The Chemistry of Death", "Simon Beckett", "Crime"));
     state.LibraryBooks.Add(new Book("Whistleblower", "Tess Gerritsen", "Crime"));
     state.LibraryBooks.Add(new Book("Whistleblower", "Tess Gerritsen", "Crime"));
     state.LibraryBooks.Add(new Book("Whistleblower", "Tess Gerritsen", "Crime"));
     state.LibraryBooks.Add(new Book("Roses are Red", "James Patterson", "Thriller"));
     state.LibraryBooks.Add(new Book("Brief Answers to the Big Questions", "Stephen Hawking", "Science"));
 }
        public void ShouldReturnLibraryStateFromQueryHandler()
        {
            LibraryState libraryStateFromHub  = null;
            var          expectedLibraryState = new LibraryState();

            _getLibraryStateQueryHandlerMock.Setup(x => x.Handle(It.IsAny <GetLibraryStateQuery>())).Returns(expectedLibraryState);

            dynamic caller = new ExpandoObject();

            caller.updateLibraryState = new Action <LibraryState>((libraryState) => {
                libraryStateFromHub = libraryState;
            });

            _mockClients.Setup(m => m.Caller).Returns((ExpandoObject)caller);

            _hub.GetLibraryState("test");

            Assert.Equal(expectedLibraryState, libraryStateFromHub);
        }
Esempio n. 9
0
        public override void PlayAsAction(ITurnScope turnScope)
        {
            while (turnScope.Player.Hand.Count() < 7)
            {
                var state = new LibraryState();
                turnScope.DrawCardIntoCardset(state.DrawnCards);
                var card = state.DrawnCards.First();
                if (card.IsAction)
                {
                    turnScope.Publish(new ActionDrawnForLibrary(card, state, turnScope));
                }
                else
                {
                    state.DrawnCards.Add(card, turnScope);
                }

                turnScope.PutCardsIntoHand(state.DrawnCards);
                turnScope.Discard(state.SetAsideCards);
            }
        }
Esempio n. 10
0
 public void TearDown()
 {
     this.processState = null;
     this.dao          = null;
 }
Esempio n. 11
0
 public void TearDown()
 {
     this.rentalDao = null;
     this.libState  = null;
 }
Esempio n. 12
0
 public void SetUp()
 {
     this.libState  = new LibraryState();
     this.rentalDao = new RentalDaoBasicImpl(libState);
 }
Esempio n. 13
0
 public TakeActionCardIntoHandForLibrary(ITurnScope turnScope, LibraryState state, Card item)
     : base(turnScope, item)
 {
     Description = "Take " + item.Name + " into hand";
     _state      = state;
 }
Esempio n. 14
0
 public SetAsideActionForLibrary(ITurnScope turnScope, LibraryState state, Card action)
     : base(turnScope, action)
 {
     Description = "Set " + action.Name + " aside";
     _state      = state;
 }
Esempio n. 15
0
 public void TearDown()
 {
     this.userDao  = null;
     this.libState = null;
 }
Esempio n. 16
0
 public void SetUp()
 {
     this.dao          = new BookDaoBasicImpl();
     this.processState = new LibraryState(dao);
 }
Esempio n. 17
0
 public void SetUp()
 {
     this.libState = new LibraryState();
     this.userDao  = new UserDaoBasicImpl(libState);
 }
Esempio n. 18
0
 public void TearDown()
 {
     bookDao  = null;
     libState = null;
 }
Esempio n. 19
0
 public void SetUp()
 {
     libState = new LibraryState();
     bookDao  = new BookDaoBasicImpl(libState);
 }
Esempio n. 20
0
 public static void SetPlantLibraryState(int speciesId, LibraryState state)
 {
     PlayerPrefs.SetString("Species_" + speciesId, state.ToString());
     PlayerPrefs.Save();
 }
Esempio n. 21
0
 public BookDaoBasicImpl(LibraryState libData)
 {
     libraryData = libData;
 }
Esempio n. 22
0
 public UserDaoBasicImpl(LibraryState libData)
 {
     libraryData = libData;
 }
Esempio n. 23
0
 public void Fill(LibraryState state)
 {
     FillBooks(state);
     FillUsers(state);
     FillRentals(state);
 }
Esempio n. 24
0
 public RentalDaoBasicImpl(LibraryState libData)
 {
     libraryData = libData;
 }