public async Task TestLoadBoardFailures()
        {
            var repository = BoardStreamRepositoryTest.SetupBoardStreamRepository(new byte[] { 1, 2 });

            await AssertExtensions.ThrowsExceptionAsync <Exception>(
                async() => await repository.LoadAsync("DummyBoardName"));
        }
예제 #2
0
        public async Task TestLoadBoardFailures()
        {
            // Prepare
            var repository = BoardStreamRepositoryTest.SetupBoardStreamRepository(new byte[] { 1, 2 });

            // Execute
            await repository.LoadAsync("DummyBoardName");
        }
        public async Task TestSaveBoard()
        {
            var buffer     = new byte[9 * 9];
            var repository = BoardStreamRepositoryTest.SetupBoardStreamRepository(buffer);

            await repository.SaveAsync("DummyBoardName", (Board)BoardSampleData.sampleBoard);

            Assert.IsTrue(BoardSampleData.sampleBoard.SequenceEqual(buffer));
        }
예제 #4
0
        public async Task TestSaveBoard()
        {
            // Prepare
            var buffer     = new byte[9 * 9];
            var repository = BoardStreamRepositoryTest.SetupBoardStreamRepository(buffer);

            // Execute
            await repository.SaveAsync("DummyBoardName", (Board)BoardSampleData.sampleBoard);

            // Assert
            CollectionAssert.AreEqual(BoardSampleData.sampleBoard, buffer);
        }
예제 #5
0
        public async Task TestLoadBoard()
        {
            // A BoardStreamRepository needs an IStreamManager. Note that we use a
            // stub generated by Microsoft Fakes here.

            // Prepare
            var repository = BoardStreamRepositoryTest.SetupBoardStreamRepository(BoardSampleData.sampleBoard);

            // Execute
            var board = await repository.LoadAsync("DummyBoardName");

            // Assert
            CollectionAssert.AreEqual(BoardSampleData.sampleBoard, (byte[])board);
        }