public void is_AllManagerStatusesAppended_ReturnMessage() { string id = "id"; // Arrange string msgDoorManager = "Doors,OK,OK,OK,FAULT,OK,FAULT,OK,OK,OK,OK"; string msgLightManager = "Lights,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK"; string msgFireAlarmManager = "FireAlarm,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK"; var stubFireAlarmManager = Substitute.For <IFireAlarmManager>(); var stubDoorManager = Substitute.For <IDoorManager>(); var stubLightManger = Substitute.For <ILightManager>(); var stubWebService = Substitute.For <IWebService>(); stubDoorManager.GetStatus().Returns(msgDoorManager); stubFireAlarmManager.GetStatus().Returns(msgFireAlarmManager); stubLightManger.GetStatus().Returns(msgLightManager); // Act BuildingController bc = new BuildingController(id, stubLightManger, stubFireAlarmManager, stubDoorManager , stubWebService, GetMockEmailService()); string result = bc.GetStatusReport(); // Assert Assert.AreEqual(stubLightManger.GetStatus() + stubDoorManager.GetStatus() + stubFireAlarmManager.GetStatus() , result); }
public void are_DoorAndFireAlarmFaulty_LogMessageDoorsFireAlarm() { // Arrange string msgLightManager = "Lights,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK"; string msgDoorManager = "Doors,OK,FAULT,OK,OK,OK,OK,OK,OK,OK,OK"; string msgFireAlarmManager = "FireAlarm,OK,OK,OK,OK,FAULT,OK,OK,OK,OK,OK"; var stubFireAlarmManager = Substitute.For <IFireAlarmManager>(); var stubDoorManager = Substitute.For <IDoorManager>(); var stubLightManger = Substitute.For <ILightManager>(); var stubWebService = Substitute.For <IWebService>(); stubDoorManager.GetStatus().Returns(msgDoorManager); stubFireAlarmManager.GetStatus().Returns(msgFireAlarmManager); stubLightManger.GetStatus().Returns(msgLightManager); var stubIEmailService = Substitute.For <IEmailService>(); // Act BuildingController bc = new BuildingController(ID, stubLightManger, stubFireAlarmManager, stubDoorManager, stubWebService, stubIEmailService); bc.GetStatusReport(); // Assert stubWebService.Received().LogEngineerRerquired("Doors, FireAlarm"); }
public void is_FireAlarmManagerGetStatus_ReturnsMessage() { // Arrange string message = "FireAlarm,OK,OK,OK,FAULT,OK,FAULT,OK,OK,OK,OK"; var stubLightManager = Substitute.For <ILightManager>(); var stubFireManager = Substitute.For <IFireAlarmManager>(); var stubDoorManager = Substitute.For <IDoorManager>(); var stubWebService = Substitute.For <IWebService>(); stubFireManager.GetStatus().Returns(message); stubDoorManager.GetStatus().Returns(""); stubLightManager.GetStatus().Returns(""); // Act BuildingController b = new BuildingController(ID, stubLightManager, stubFireManager, stubDoorManager, stubWebService, GetMockEmailService()); // Assert Assert.AreEqual(message, b.GetStatusReport()); }