public TraceControllerTestBase() { TraceServiceMock = new Mock<ITraceService>(); CommuStatusServiceMock = new Mock<ICommuStatusService>(); AppStoreUIServiceMock = new Mock<IAppStoreUIService>(); ReportingServiceMock = new Mock<IReportingService>(); Controller = new TraceController(TraceServiceMock.Object,CommuStatusServiceMock.Object,AppStoreUIServiceMock.Object, ReportingServiceMock.Object); }
public TraceControllerTest() { var options = new DbContextOptionsBuilder <BD_EPM>() .UseInMemoryDatabase("DatabaseTrace-" + $"{Guid.NewGuid()}") .Options; var bdEnMemoire = new BD_EPM(options); _traceController = new TraceController(bdEnMemoire, new FakeUpload()); }
public ActionResult DownloadExcel(string data) { distribution_copy.Models.ExpandWI.RootObject urlResponse = new distribution_copy.Models.ExpandWI.RootObject(); Download model = new Download(); model = JsonConvert.DeserializeObject <Download>(data); TraceInputModel input = new TraceInputModel(); input.OrgName = model.AccountName; input.ProjectName = model.ProjectName; input.WIType = "Epic"; AccountService accountService = new AccountService(); TraceController trace = new TraceController(); ExcelPackage excel = trace.TraceExport(input, false); var added = trace.added; urlResponse.value = ((distribution_copy.Models.ExpandWI.RootObject)System.Web.HttpContext.Current.Session["EWorkItems"]).value.Where(x => (!added.Contains(x)) && x.fields.TeamProject == input.ProjectName).ToList(); var workSheet = excel.Workbook.Worksheets[0]; var colcount = workSheet.Dimension.End.Column; var rowCount = workSheet.Dimension.End.Row + 1; List <string> colNames = new List <string>(); for (int i = 1; i <= colcount; i++) { colNames.Add(workSheet.Cells[1, i].Value.ToString()); } int titlecount = colNames.Where(x => x.ToLower().StartsWith("title")).Count(); foreach (var WI in urlResponse.value) { int columnNo = 0; workSheet.Cells[rowCount, ++columnNo].Value = WI.id; workSheet.Cells[rowCount, ++columnNo].Value = WI.fields.WorkItemType; workSheet.Cells[rowCount, ++columnNo].Value = WI.fields.Title; columnNo += titlecount; workSheet.Cells[rowCount, columnNo++].Value = WI.fields.TeamProject; workSheet.Cells[rowCount, columnNo++].Value = WI.fields.State; workSheet.Cells[rowCount, columnNo++].Value = WI.fields.AreaPath; workSheet.Cells[rowCount, columnNo++].Value = WI.fields.IterationPath; rowCount++; } string excelName = input.OrgName + "-" + input.ProjectName + DateTime.Now.ToString(); using (var memoryStream = new MemoryStream()) { Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=" + excelName + ".xlsx"); excel.SaveAs(memoryStream); memoryStream.WriteTo(Response.OutputStream); Response.Flush(); Response.End(); } return(null); }
public void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad (this); allItemDic = new Dictionary<string, ItemState>(); lineRenderer = transform.GetComponent<LineRenderer>(); Init(); } else { DestroyImmediate(gameObject); } }
public void Create_returns_BadRequest_when_minutes_is_greater_than_10() { var sut = new TraceController(null, null, null); var result = (BadRequestErrorMessageResult)sut.Create(new StartTrace() { LinkId = Guid.NewGuid(), Minutes = 11 }); result.Should().NotBeNull(); result.Message.Should().Be("Tracking can only be enabled for ten minutes at most."); }
public void Create_returns_BadRequest_when_minutes_is_less_than_1() { var sut = new TraceController(null, null, null); var result = (BadRequestErrorMessageResult)sut.Create(new StartTrace() { LinkId = Guid.NewGuid(), Minutes = 0 }); result.Should().NotBeNull(); result.Message.Should().Be("Tracking must be enabled for one minute at least."); }
public void Disable_returns_BadRequest_result_when_TraceConfiguration_was_not_disabled() { var traceRepositoryMock = new Mock <ITraceRepository>(); var sut = new TraceController(traceRepositoryMock.Object, null, null); IHttpActionResult result; var traceConnectionId = Guid.NewGuid(); traceRepositoryMock.Setup(t => t.Disable(traceConnectionId)).Returns(false); result = sut.Disable(traceConnectionId); traceRepositoryMock.VerifyAll(); (result as BadRequestResult).Should().NotBeNull(); }
public bool Start() { try { _trace = new TraceControllerBuilder().GetTraceController(_database, _databaseName, _traceType); _trace.Start(); return(true); } catch (Exception ex) { Debug("Error starting trace: {0}", ex); return(false); } }
public void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this); allItemDic = new Dictionary <string, ItemState>(); lineRenderer = transform.GetComponent <LineRenderer>(); //Init(); } else { DestroyImmediate(gameObject); } }
public void Get_returns_a_list_of_TraceConfigurations_for_the_given_linkId() { var traceRepositoryMock = new Mock <ITraceRepository>(); var sut = new TraceController(traceRepositoryMock.Object, null, null); var linkId = Guid.NewGuid(); var traceConfigurationList = new List <TraceConfiguration>(); traceRepositoryMock.Setup(t => t.GetTraceConfigurations(linkId)) .Returns(traceConfigurationList); var response = sut.Get(linkId) as OkNegotiatedContentResult <IEnumerable <TraceConfiguration> >; traceRepositoryMock.VerifyAll(); response.Content.Should().BeSameAs(traceConfigurationList); }
public void IsRunning_returns_false_when_no_trace_configuration_is_available() { var traceRepositoryMock = new Mock <ITraceRepository>(); var sut = new TraceController(traceRepositoryMock.Object, null, null); var connectionId = Guid.NewGuid(); traceRepositoryMock.Setup(t => t.GetRunningTranceConfiguration(connectionId)) .Returns(value: null); var response = sut.IsRunning(connectionId) as OkNegotiatedContentResult <RunningTraceConfiguration>; traceRepositoryMock.VerifyAll(); response.Content.IsRunning.Should().BeFalse(); response.Content.TraceConfiguration.Should().BeNull(); }
public bool Start() { Exception = null; try { _trace = new TraceControllerBuilder().GetTraceController(_database, _databaseName, _traceType); _trace.Start(); IsStarted = true; return(true); } catch (Exception ex) { Debug("Error starting trace: {0}", ex); Exception = new SqlCoverException("SQL Cover failed to start.", ex); IsStarted = false; return(false); } }
public async Task GetFileInfoInformations_returns_the_correct_file_informations_for_given_traceConfigurationId() { var traceManagerMock = new Mock <ITraceManager>(); var sut = new TraceController(null, traceManagerMock.Object, null); var traceId = Guid.NewGuid(); var traceFiles = new Collection <Trace>() { new Trace() { OnPremiseConnectorTrace = new TraceFile() { ContentFileName = Guid.NewGuid() + "cr.content", HeaderFileName = Guid.NewGuid() + "cr.header", Headers = new Dictionary <string, string>() { { "Content-Length", "100" } } }, OnPremiseTargetTrace = new TraceFile() { ContentFileName = Guid.NewGuid() + "ltr.content", HeaderFileName = Guid.NewGuid() + "ltr.header", Headers = new Dictionary <string, string>() { { "Content-Length", "100" } } }, TracingDate = DateTime.Now } }; traceManagerMock.Setup(t => t.GetTracesAsync(traceId)) .ReturnsAsync(traceFiles); var response = await sut.GetFileInformations(traceId) as OkNegotiatedContentResult <IEnumerable <Trace> >; traceManagerMock.VerifyAll(); response.Content.Should().BeSameAs(traceFiles); }
public void Create_returns_Created_result_with_properly_set_DTO() { var traceRepositoryMock = new Mock <ITraceRepository>(); var sut = new TraceController(traceRepositoryMock.Object, null, null); CreatedNegotiatedContentResult <TraceConfiguration> result; var startDate = DateTime.UtcNow; var linkId = Guid.NewGuid(); traceRepositoryMock.Setup(t => t.Create(It.IsAny <TraceConfiguration>())); result = (CreatedNegotiatedContentResult <TraceConfiguration>)sut.Create(new StartTrace() { Minutes = 5, LinkId = linkId }); traceRepositoryMock.VerifyAll(); result.Should().NotBeNull(); result.Content.StartDate.Should().BeOnOrAfter(startDate).And.BeOnOrBefore(DateTime.UtcNow); result.Content.EndDate.Should().BeOnOrAfter(startDate.AddMinutes(5)).And.BeBefore(DateTime.UtcNow.AddMinutes(5)); result.Content.LinkId.Should().Be(linkId); }
public void GetTraceConfiguration_returns_the_correct_trace_configuration_for_given_traceConfigurationId() { var traceRepositoryMock = new Mock <ITraceRepository>(); var sut = new TraceController(traceRepositoryMock.Object, null, null); var traceId = Guid.NewGuid(); var traceConfiguration = new TraceConfiguration() { CreationDate = DateTime.Now, EndDate = DateTime.Now.AddMinutes(2), Id = traceId, LinkId = Guid.NewGuid(), StartDate = DateTime.Now }; traceRepositoryMock.Setup(t => t.GetTraceConfiguration(traceId)) .Returns(traceConfiguration); var response = sut.GetTraceConfiguration(traceId) as OkNegotiatedContentResult <TraceConfiguration>; traceRepositoryMock.VerifyAll(); response.Content.Should().BeSameAs(traceConfiguration); }
public void IsRunning_returns_true_when_trace_is_running_and_no_old_trace_is_in_configuration_list() { var traceRepositoryMock = new Mock <ITraceRepository>(); var sut = new TraceController(traceRepositoryMock.Object, null, null); var connectionId = Guid.NewGuid(); var traceConfiguration = new TraceConfiguration() { CreationDate = DateTime.Now, EndDate = DateTime.Now.AddMinutes(2), Id = Guid.NewGuid(), LinkId = connectionId, StartDate = DateTime.Now }; traceRepositoryMock.Setup(t => t.GetRunningTranceConfiguration(connectionId)) .Returns(traceConfiguration); var response = sut.IsRunning(connectionId) as OkNegotiatedContentResult <RunningTraceConfiguration>; traceRepositoryMock.VerifyAll(); response.Content.IsRunning.Should().BeTrue(); response.Content.TraceConfiguration.Should().BeSameAs(traceConfiguration); }
public LandEvent(Vector3 velocityBeforeLand) : base(Vector3.zero, velocityBeforeLand) { player = SimpleGameManager.Instance.player; }
public void Start() { _trace = new TraceControllerBuilder().GetTraceController(_database, _databaseName, _traceType); _trace.Start(); }
public JumpEvent() : base(Vector3.zero, Vector3.zero) { player = SimpleGameManager.Instance.player; doValue = player.velocity; doValue.y = player.jumpSpeed; }