コード例 #1
0
        public void SetUp()
        {
            mocks = new MockRepository();
            gameService = mocks.DynamicMock<IGameService>();
            repository = mocks.DynamicMock<IRepository<Game>>();
            service = new RecalcGameStateService(1, repository, gameService);

            game = new Game
            {
                GameState = GameStates.Started,
                GameDate = new DateTime(2010, 1, 1, 21, 0, 0),
                TotalTime = 540,
                TimePerTask = 90,
                TimePerTip = 30
            };

            task1 = new Task();
            task1Tip0 = new Tip { SuspendTime = 0, Task = task1 };
            task1Tip1 = new Tip { SuspendTime = 30, Task = task1 };
            task1Tip2 = new Tip { SuspendTime = 60, Task = task1 };
            task1.Tips.Add(task1Tip0);
            task1.Tips.Add(task1Tip1);
            task1.Tips.Add(task1Tip2);
            task1.Codes.Add(new Code { Name = "1", Task = task1 });

            game.Tasks.Add(task1);
        }
コード例 #2
0
        public void SetUp()
        {
            mocks = new MockRepository();
            gameService = mocks.DynamicMock<IGameService>();
            repository = mocks.DynamicMock<IRepository<Game>>();
            dbContext = mocks.DynamicMock<IDbContext>();
            service = new RecalcGameStateService(1, repository, gameService);

            game = new Game
            {
                GameState = GameStates.Started,
                GameDate = new DateTime(2010, 1, 1, 21, 0, 0),
                TotalTime = 540,
                TimePerTask = 90,
                TimePerTip = 30
            };

            task1 = new Task();
            task1Tip0 = new Tip { SuspendTime = 0, Task = task1 };
            task1Tip1 = new Tip { SuspendTime = 30, Task = task1 };
            task1Tip2 = new Tip { SuspendTime = 60, Task = task1 };
            task1.Tips.Add(task1Tip0);
            task1.Tips.Add(task1Tip1);
            task1.Tips.Add(task1Tip2);
            task1.Codes.Add(new Code { Name = "1", Task = task1 });

            game.Tasks.Add(task1);

            Expect.Call(repository.DbContext).Return(dbContext).Repeat.Any();
            Expect.Call(dbContext.BeginTransaction()).Repeat.Any();
            Expect.Call(() => dbContext.CommitTransaction()).Repeat.Any();
        }