public async void TestForCreatePlaybook()
        {
            var options = new DbContextOptionsBuilder <PlaybookContext>()
                          .UseInMemoryDatabase(databaseName: "p3PlaybookService")
                          .Options;

            using (var context = new PlaybookContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo               r                  = new Repo(context, new NullLogger <Repo>());
                Mapper             mapper             = new Mapper();
                Logic              logic              = new Logic(r, mapper, new NullLogger <Repo>());
                PlaybookController playbookController = new PlaybookController(logic, new NullLogger <PlaybookController>());
                var playbook = new Playbook
                {
                    Playbookid = Guid.NewGuid(),
                    TeamID     = Guid.NewGuid(),
                    Name       = "myplaybook",
                    InDev      = true
                };

                var createPlaybook = await playbookController.CreatePlaybook(playbook.Playbookid.ToString(), playbook.Name);

                Assert.NotEmpty(context.Playbooks);
                Assert.Equal("myplaybook", createPlaybook.Value.Name);
            }
        }
        public async void TestForDeletePlay()
        {
            var options = new DbContextOptionsBuilder <PlaybookContext>()
                          .UseInMemoryDatabase(databaseName: "p3PlaybookService")
                          .Options;

            using (var context = new PlaybookContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo               r                  = new Repo(context, new NullLogger <Repo>());
                Mapper             mapper             = new Mapper();
                Logic              logic              = new Logic(r, mapper, new NullLogger <Repo>());
                PlaybookController playbookController = new PlaybookController(logic, new NullLogger <PlaybookController>());
                var play = new Play
                {
                    PlayID      = Guid.NewGuid(),
                    PlaybookId  = Guid.NewGuid(),
                    Name        = "Tackle",
                    Description = "Tackle other players",
                    DrawnPlay   = new byte[1]
                };

                r.Plays.Add(play);
                await r.CommitSave();

                Assert.NotEmpty(context.Plays);
                var deletePlay = await playbookController.DeletePlay(play.PlayID.ToString());

                var getPlay = await logic.GetPlayById(play.PlayID);

                Assert.Null(getPlay);
            }
        }
        public async void TestForCreatePlay()
        {
            var options = new DbContextOptionsBuilder <PlaybookContext>()
                          .UseInMemoryDatabase(databaseName: "p3PlaybookService")
                          .Options;

            using (var context = new PlaybookContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo               r                  = new Repo(context, new NullLogger <Repo>());
                Mapper             mapper             = new Mapper();
                Logic              logic              = new Logic(r, mapper, new NullLogger <Repo>());
                PlaybookController playbookController = new PlaybookController(logic, new NullLogger <PlaybookController>());
                var playDto = new PlayDto
                {
                    PlayID      = Guid.NewGuid(),
                    PlaybookID  = Guid.NewGuid(),
                    Name        = "Tackle",
                    Description = "Tackle other players",
                    DrawnPlay   = new byte[1],
                    ImageString = "football,football"
                };

                var createPlay = await playbookController.CreatePlay(playDto);

                Assert.NotEmpty(context.Plays);
                Assert.Equal("Tackle", createPlay.Value.Name);
                Assert.Equal("Tackle other players", createPlay.Value.Description);
            }
        }
        public async void TestForDeletePlaybook()
        {
            var options = new DbContextOptionsBuilder <PlaybookContext>()
                          .UseInMemoryDatabase(databaseName: "p3PlaybookController")
                          .Options;

            using (var context = new PlaybookContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo               r                  = new Repo(context, new NullLogger <Repo>());
                Mapper             mapper             = new Mapper();
                Logic              logic              = new Logic(r, mapper, new NullLogger <Repo>());
                PlaybookController playbookController = new PlaybookController(logic, new NullLogger <PlaybookController>());
                var playbook = new Playbook
                {
                    Playbookid = Guid.NewGuid(),
                    TeamID     = Guid.NewGuid(),
                    Name       = "myplaybook",
                    InDev      = true
                };
                r.Playbooks.Add(playbook);
                await r.CommitSave();

                Assert.NotEmpty(context.Playbooks);
                var deletePlaybook = await playbookController.DeletePlaybook(playbook.Playbookid.ToString());

                var getPlaybook = await logic.GetPlaybookById(playbook.Playbookid);

                Assert.Null(getPlaybook);
            }
        }
        public async void TestForGetPlays()
        {
            var options = new DbContextOptionsBuilder <PlaybookContext>()
                          .UseInMemoryDatabase(databaseName: "p3PlaybookService")
                          .Options;

            using (var context = new PlaybookContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo               r                  = new Repo(context, new NullLogger <Repo>());
                Mapper             mapper             = new Mapper();
                Logic              logic              = new Logic(r, mapper, new NullLogger <Repo>());
                PlaybookController playbookController = new PlaybookController(logic, new NullLogger <PlaybookController>());
                var play = new Play
                {
                    PlayID      = Guid.NewGuid(),
                    PlaybookId  = Guid.NewGuid(),
                    Name        = "Tackle",
                    Description = "Tackle other players",
                    DrawnPlay   = new byte[1]
                };

                r.Plays.Add(play);
                var play2 = new Play
                {
                    PlayID      = Guid.NewGuid(),
                    PlaybookId  = Guid.NewGuid(),
                    Name        = "Run",
                    Description = "Run with ball",
                    DrawnPlay   = new byte[1]
                };

                r.Plays.Add(play2);
                await r.CommitSave();

                var listOfPlays = await playbookController.GetPlays();

                var convertedList = (List <PlayDto>)listOfPlays;
                Assert.NotNull(listOfPlays);
                Assert.Equal("Tackle", convertedList[0].Name);
                Assert.Equal("Tackle other players", convertedList[0].Description);
                Assert.Equal("Run", convertedList[1].Name);
                Assert.Equal("Run with ball", convertedList[1].Description);
            }
        }
        public async void TestForGetPlaybooks()
        {
            var options = new DbContextOptionsBuilder <PlaybookContext>()
                          .UseInMemoryDatabase(databaseName: "p3PlaybookService")
                          .Options;

            using (var context = new PlaybookContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo               r                  = new Repo(context, new NullLogger <Repo>());
                Mapper             mapper             = new Mapper();
                Logic              logic              = new Logic(r, mapper, new NullLogger <Repo>());
                PlaybookController playbookController = new PlaybookController(logic, new NullLogger <PlaybookController>());
                var playbook = new Playbook
                {
                    Playbookid = Guid.NewGuid(),
                    TeamID     = Guid.NewGuid(),
                    Name       = "myplaybook",
                    InDev      = true
                };
                r.Playbooks.Add(playbook);
                var playbook2 = new Playbook
                {
                    Playbookid = Guid.NewGuid(),
                    TeamID     = Guid.NewGuid(),
                    Name       = "myplaybook2",
                    InDev      = true
                };
                r.Playbooks.Add(playbook2);
                await r.CommitSave();

                var listOfPlaybooks = await playbookController.GetPlaybooks();

                var convertedList = (List <Playbook>)listOfPlaybooks;
                Assert.NotNull(listOfPlaybooks);
                Assert.Equal("myplaybook", convertedList[0].Name);
                Assert.Equal("myplaybook2", convertedList[1].Name);
            }
        }