public async Task GetToggledAsync_BadRequest()
        {
            var id   = string.Empty;
            var mock = new Mock <IToggleBusinessManager>();

            mock.Setup(toggleBusinessManager => toggleBusinessManager.GetToggleAsync(id)).Returns(Task.FromResult(new Response <ToggleDto>()));

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = (await controller.GetToggleAsync(id)) as BadRequestResult;
                Assert.IsNotNull(responseActionResult);
            }
        }
        public async Task GetToggledAsync_NotFound()
        {
            var id   = "12345";
            var mock = new Mock <IToggleBusinessManager>();

            mock.Setup(toggleBusinessManager => toggleBusinessManager.GetToggleAsync(id)).Throws(new ArgumentOutOfRangeException());

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = (await controller.GetToggleAsync(id)) as NotFoundResult;
                Assert.IsNotNull(responseActionResult);
            }
        }
        public async Task GetToggledAsyncc_InternalServerError()
        {
            var id   = Guid.NewGuid().ToString();
            var mock = new Mock <IToggleBusinessManager>();

            mock.Setup(toggleBusinessManager => toggleBusinessManager.GetToggleAsync(id)).Throws(new NullReferenceException());

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = (await controller.GetToggleAsync(id)) as ExceptionResult;
                Assert.IsNotNull(responseActionResult);
                Assert.IsTrue(responseActionResult.Exception is NullReferenceException);
            }
        }
        public async Task GetToggledAsync_Ok()
        {
            var toggle1 = ToggleFakeData.GetToggleDto1();

            var mock = new Mock <IToggleBusinessManager>();

            mock.Setup(toggleBusinessManager => toggleBusinessManager.GetToggleAsync(toggle1.Id)).Returns(Task.FromResult(ToggleFakeData.GetResponseWithToggleDto1()));

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = (await controller.GetToggleAsync(toggle1.Id)) as OkNegotiatedContentResult <Response <ToggleDto> >;
                Assert.IsNotNull(responseActionResult);
                Assert.IsNotNull(responseActionResult.Content);
                Assert.IsNotNull(responseActionResult.Content.Result);
                Assert.IsNotNull(responseActionResult.Content.Result.Id);
                Assert.IsNotNull(responseActionResult.Content.Result.Name);

                Assert.AreEqual(toggle1.Id, responseActionResult.Content.Result.Id);
                Assert.AreEqual(toggle1.Name, responseActionResult.Content.Result.Name);
                Assert.AreEqual(toggle1.Version, responseActionResult.Content.Result.Version);
                Assert.AreEqual(toggle1.Applications.Count(), responseActionResult.Content.Result.Applications.Count());
            }
        }