public void ReviewTasksReturnTasks() { _repository.Setup(x => x.GetTasksForReview()).Returns(new List <Tasks> { new Tasks { TasksId = 1, Title = "Hello", Description = "Bananas", Complete = false }, new Tasks { TasksId = 2, Title = "Greetings", Description = "Bananas", Complete = false }, new Tasks { TasksId = 3, Title = "Bye", Description = "Bananas", Complete = false } }); _controller = new DeveloperController(_repository.Object) { ControllerContext = MockHelper.FakeControllerContext(false) }; var res = _controller.ReviewTasks() as ViewResult; Assert.IsNotNull(res); CollectionAssert.AllItemsAreInstancesOfType((ICollection)res.ViewData.Model, typeof(Tasks), "Not tasks"); _repository.Verify(x => x.GetTasksForReview(), Times.Exactly(1)); }
public void Arrange() { _mockService = new MockDeveloperService { ReturnValue = true }; _controller = new DeveloperController(_mockService); }
private void Awake() { if (objectAnimator == null) { ObjectAnimator = GetComponent <Animator>(); } developer = FindObjectOfType <DeveloperController>(); }
public void Setup() { mockDeveloperRepo = new Mock <IDeveloperRepository>(); mockDeveloperService = new Mock <IDeveloperService>(); developerService = new DeveloperService(mockDeveloperRepo.Object); developerController = new DeveloperController(mockDeveloperService.Object); }
public DeveloperController_UnitTest() { //Mock cache DI var cache = new MemoryCache(new MemoryCacheOptions()); //Set mock list of developers on cache List <Developer> developers = Developer.FromJson(System.IO.File.ReadAllText("developers.mock.json")); cache.Set("ListOfDevelopers", developers); _controller = new DeveloperController(cache); }
public void ReturnIndexView() { _controller = new DeveloperController(_repository.Object) { ControllerContext = MockHelper.FakeControllerContext(false) }; var res = (ViewResult)_controller.Index(); Assert.IsNotNull(res, "No view returned"); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); BootstrapBundleConfig.RegisterBundles(); AuthConfig.RegisterAuth(); DeveloperController.InitiateAccounts(); }
/// <summary> /// Construct a new developer. /// </summary> protected Developer(string name, Developer left, Developer right, DeveloperController controller) { m_Left = left; m_Right = right; m_controller = controller; m_Name = name; m_CodingDelay = 1000; m_ThinkingDelay = 1000; m_CodingCount = 0; m_UseRandomDelay = true; m_controller.Start += new EventHandler(Controller_Start); SetState(DeveloperState.Thinking); }
public void ReviewTasksPostDataUpdateNoError() { _repository.Setup(x => x.CompleteTask(It.IsAny <Tasks>())); _controller = new DeveloperController(_repository.Object) { ControllerContext = MockHelper.FakeControllerContext(false) }; var res = _controller.ReviewTasks(new Tasks()); Assert.IsNotNull(res); _repository.VerifyAll(); Assert.IsInstanceOfType(res, typeof(RedirectToActionResult)); }
public void ReviewTasksPostDataUpdateError() { _repository.Setup(x => x.CompleteTask(It.IsAny <Tasks>())).Throws(new Exception()); _controller = new DeveloperController(_repository.Object) { ControllerContext = MockHelper.FakeControllerContext(false) }; var res = _controller.ReviewTasks(new Tasks()); Assert.IsNotNull(res); _repository.VerifyAll(); _repository.Verify(x => x.CompleteTask(It.IsAny <Tasks>()), Times.Exactly(1)); }
public void Init() { var devList = TestsData.DevList.ToList(); var repositoryMock = new Mock <IDeveloperRepository>(); repositoryMock.Setup(x => x.Developers).Returns(devList); repositoryMock.Setup(x => x.Get(It.IsAny <int>())) .Returns((int id) => { return(devList.FirstOrDefault(y => y.DeveloperId == id)); }); var service = new DeveloperService(repositoryMock.Object); _controller = new DeveloperController(service); _controller.Request = new HttpRequestMessage(); _controller.Configuration = new HttpConfiguration(); }
public override Developer NewDeveloper(string name, Developer left, Developer right, DeveloperController controller) { return new MonitorBasedDeveloper(name, left, right, controller); }
public DeveloperControllerTests( ) { _mediator = Substitute.For <IMediator>(); _controller = new DeveloperController(_mediator); }
public override Developer NewDeveloper(string name, Developer left, Developer right, DeveloperController controller) { return(new MonitorBasedDeveloper(name, left, right, controller)); }
/// <summary> /// Constructs a new developer. /// </summary> /// <param name="name">The name of the developer.</param> /// <param name="left">The developer to the immediate left.</param> /// <param name="right">The developer to the immediate right.</param> /// <param name="controller">The controller.</param> /// <returns>The newly constructed developer.</returns> public abstract Developer NewDeveloper(string name, Developer left, Developer right, DeveloperController controller);
/// <summary> /// Constructs a new developer. /// </summary> /// <param name="name">The name of the developer.</param> /// <param name="left">The developer to the immediate left.</param> /// <param name="right">The developer to the immediate right.</param> /// <param name="controller">The controller.</param> /// <returns>The newly constructed developer.</returns> public abstract Developer NewDeveloper(string name, Developer left, Developer right, DeveloperController controller);
public MonitorBasedDeveloper(string name, Developer left, Developer right, DeveloperController controller) : base(name, left, right, controller) { }
/// <summary> /// Construct a new developer. /// </summary> protected Developer(string name, Developer left, Developer right, DeveloperController controller) { m_Left = left; m_Right = right; m_controller = controller; m_Name = name; m_CodingDelay = 1000; m_ThinkingDelay = 1000; m_CodingCount = 0; m_UseRandomDelay = true; m_controller.Start += new EventHandler(Controller_Start); SetState(DeveloperState.Thinking); }
public MonitorBasedDeveloper(string name, Developer left, Developer right, DeveloperController controller) : base(name, left, right, controller) { }