public async Task GetTogglesAsync_GetResponseWith2ToggleDtos_Ok()
        {
            var mock = new Mock <IToggleBusinessManager>();

            mock.Setup(toggleBusinessManager => toggleBusinessManager.GetTogglesAsync()).Returns(Task.FromResult(ToggleFakeData.GetResponseWith2ToggleDtos()));

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = await controller.GetTogglesAsync() as OkNegotiatedContentResult <Response <IEnumerable <ToggleDto> > >;

                Assert.IsNotNull(responseActionResult);
                Assert.IsNotNull(responseActionResult);
                Assert.IsNull(responseActionResult.Content.ErrorCode);
                Assert.IsNull(responseActionResult.Content.Message);
                Assert.IsTrue(responseActionResult.Content.IsValid);
                Assert.IsTrue(responseActionResult.Content.Result.Count() == 2);
                foreach (var item in responseActionResult.Content.Result)
                {
                    Assert.IsNotNull(item.Id);
                    Assert.IsNotNull(item.Name);
                    Assert.IsNotNull(item.Version);
                    Assert.IsNotNull(item.Applications);
                    foreach (var app in item.Applications)
                    {
                        Assert.IsNotNull(app.Id);
                        Assert.IsNotNull(app.Name);
                    }
                }
            }
        }
        public async Task GetTogglesAsync_InternalServerError()
        {
            var mock = new Mock <IToggleBusinessManager>();

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

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = (await controller.GetTogglesAsync()) as ExceptionResult;
                Assert.IsNotNull(responseActionResult);
                Assert.IsTrue(responseActionResult.Exception is NullReferenceException);
            }
        }
        public async Task GetTogglesAsync_GetResponseWithErrorCodeAndMessage_Ok()
        {
            var mock = new Mock <IToggleBusinessManager>();

            mock.Setup(toggleBusinessManager => toggleBusinessManager.GetTogglesAsync()).Returns(Task.FromResult(ToggleFakeData.GetResponseWithErrorCodeAndMessage()));

            using (var controller = new ToggleController(mock.Object))
            {
                var responseActionResult = await controller.GetTogglesAsync() as OkNegotiatedContentResult <Response <IEnumerable <ToggleDto> > >;

                Assert.IsNotNull(responseActionResult);
                Assert.IsNotNull(responseActionResult);
                Assert.IsNotNull(responseActionResult.Content.ErrorCode);
                Assert.IsNotNull(responseActionResult.Content.Message);
                Assert.IsFalse(responseActionResult.Content.IsValid);
                Assert.IsNull(responseActionResult.Content.Result);
            }
        }