diff --git a/mohaymen-codestar-Team02/Controllers/AdminController.cs b/mohaymen-codestar-Team02/Controllers/AdminController.cs index 2ad80c2..7a4f0f3 100644 --- a/mohaymen-codestar-Team02/Controllers/AdminController.cs +++ b/mohaymen-codestar-Team02/Controllers/AdminController.cs @@ -1,8 +1,10 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using mohaymen_codestar_Team02.Dto; using mohaymen_codestar_Team02.Dto.User; using mohaymen_codestar_Team02.Dto.UserDtos; using mohaymen_codestar_Team02.Dto.UserRole; +using mohaymen_codestar_Team02.Exception; using mohaymen_codestar_Team02.Models; using mohaymen_codestar_Team02.Services.Administration; @@ -23,32 +25,58 @@ public AdminController(IAdminService adminService) [HttpGet("users")] public async Task GetAllUsers([FromQuery] int pageNumber) { - var response = - await _adminService.GetUsersPaginated(pageNumber); + ServiceResponse> response; + try + { + response = + await _adminService.GetUsersPaginated(pageNumber); + } + catch (ProgramException e) + { + response = new ServiceResponse>(null, ApiResponseType.InternalServerError, e.Message); + } + return StatusCode((int)response.Type, response); } [HttpGet("users/{username}")] public async Task GetSingleUser(string? username) { - var response = - await _adminService.GetUserByUsername(username); + ServiceResponse response; + try + { + response = + await _adminService.GetUserByUsername(username); + } + catch (ProgramException e) + { + response = new ServiceResponse(null, ApiResponseType.InternalServerError, e.Message); + } + return StatusCode((int)response.Type, response); } [HttpPost("users")] public async Task CreateUser([FromBody] CreateUserDto request) { - var user = new User + ServiceResponse response; + try { - Username = request.Username, - FirstName = request.FirstName, - LastName = request.LastName, - Email = request.Email - }; - - var response = - await _adminService.CreateUser(user, request.Password, request.Roles); + var user = new User + { + Username = request.Username, + FirstName = request.FirstName, + LastName = request.LastName, + Email = request.Email + }; + + response = + await _adminService.CreateUser(user, request.Password, request.Roles); + } + catch (ProgramException e) + { + response = new ServiceResponse(null, ApiResponseType.InternalServerError, e.Message); + } return StatusCode((int)response.Type, response); } @@ -56,13 +84,21 @@ public async Task CreateUser([FromBody] CreateUserDto request) [HttpDelete("users/{username}")] public async Task DeleteUser(string username) { - var user = new User + ServiceResponse response; + try { - Username = username - }; - - var response = - await _adminService.DeleteUser(user); + var user = new User + { + Username = username + }; + + response = + await _adminService.DeleteUser(user); + } + catch (ProgramException e) + { + response = new ServiceResponse(null, ApiResponseType.InternalServerError, e.Message); + } return StatusCode((int)response.Type, response); } @@ -70,15 +106,24 @@ public async Task DeleteUser(string username) [HttpPut("users/update/{username}")] public async Task UpdateUser([FromBody] UpdateUserDto request, string username) { - var updateUser = new User() + ServiceResponse response; + try + { + var updateUser = new User() + { + Username = username, + FirstName = request.FirstName, + LastName = request.LastName, + Email = request.Email + }; + + response = await _adminService.UpdateUser(updateUser); + } + catch (ProgramException e) { - Username = username, - FirstName = request.FirstName, - LastName = request.LastName, - Email = request.Email - }; + response = new ServiceResponse(null, ApiResponseType.InternalServerError, e.Message); + } - ServiceResponse response = await _adminService.UpdateUser(updateUser); return StatusCode((int)response.Type, response); } diff --git a/mohaymen-codestar-Team02/Controllers/AnalystController.cs b/mohaymen-codestar-Team02/Controllers/AnalystController.cs index ad9a0ee..f781477 100644 --- a/mohaymen-codestar-Team02/Controllers/AnalystController.cs +++ b/mohaymen-codestar-Team02/Controllers/AnalystController.cs @@ -1,6 +1,10 @@ using Microsoft.AspNetCore.Mvc; using mohaymen_codestar_Team02.Dto; +using mohaymen_codestar_Team02.Dto.GraphDTO; +using mohaymen_codestar_Team02.Exception; +using mohaymen_codestar_Team02.Models; using mohaymen_codestar_Team02.Services.AnalystService; +using mohaymen_codestar_Team02.Services.DataAdminService; namespace mohaymen_codestar_Team02.Controllers; @@ -8,35 +12,78 @@ public class AnalystController : ControllerBase { private readonly IAnalystService _analystService; + public AnalystController(IAnalystService analystService) + { + _analystService = analystService; + } + [HttpGet("Analyst/{vertexId}")] public async Task ExpandVertex([FromQuery] GraphQueryInfoDto graphQueryInfoDto, string vertexId) { - var Response = await _analystService.GetTheVertexNeighbor(graphQueryInfoDto, vertexId); - return StatusCode((int)Response.Type, Response); + ServiceResponse response; + try + { + response = await _analystService.GetTheVertexNeighbor(graphQueryInfoDto, vertexId); + } + catch (ProgramException e) + { + response = new ServiceResponse(null, ApiResponseType.InternalServerError, e.Message); + } + + return StatusCode((int)response.Type, response); } [HttpPost("Analyst")] public async Task DisplayDataSetAsGraph([FromBody] FilterGraphDto filterGraphDto) { - var response = - await _analystService.DisplayGeraphData(filterGraphDto.DatasetId, filterGraphDto.SourceIdentifier, - filterGraphDto.TargetIdentifier, filterGraphDto.VertexIdentifier, filterGraphDto.VertexAttributeValues, - filterGraphDto.EdgeAttributeValues); - response.Data.GraphId = filterGraphDto.DatasetId; + ServiceResponse response; + try + { + response = + await _analystService.DisplayGeraphData(filterGraphDto.DatasetId, filterGraphDto.SourceIdentifier, + filterGraphDto.TargetIdentifier, filterGraphDto.VertexIdentifier, + filterGraphDto.VertexAttributeValues, + filterGraphDto.EdgeAttributeValues); + response.Data.GraphId = filterGraphDto.DatasetId; + } + catch (ProgramException e) + { + response = new ServiceResponse(null, ApiResponseType.InternalServerError, e.Message); + } + return StatusCode((int)response.Type, response); } [HttpGet("Analyst/Vertex/{id}")] public IActionResult DisplayVertexAttributes(long id) { - var response = _analystService.GetVertexAttributes(id); + ServiceResponse> response; + try + { + response = _analystService.GetVertexAttributes(id); + return StatusCode((int)response.Type, response); + } + catch (ProgramException e) + { + response = new ServiceResponse>(null, ApiResponseType.InternalServerError, e.Message); + } + return StatusCode((int)response.Type, response); } [HttpGet("Analyst/Edge/{id}")] public IActionResult DisplayEdgeAttributes(long id) { - var response = _analystService.GetEdgeAttributes(id); + ServiceResponse> response; + try + { + response = _analystService.GetEdgeAttributes(id); + } + catch (ProgramException e) + { + response = new ServiceResponse>(null, ApiResponseType.InternalServerError, e.Message); + } + return StatusCode((int)response.Type, response); } } \ No newline at end of file diff --git a/mohaymen-codestar-Team02/Controllers/DataAdminController.cs b/mohaymen-codestar-Team02/Controllers/DataAdminController.cs index 7125b44..f45374d 100644 --- a/mohaymen-codestar-Team02/Controllers/DataAdminController.cs +++ b/mohaymen-codestar-Team02/Controllers/DataAdminController.cs @@ -15,7 +15,7 @@ public class DataAdminController : ControllerBase { private readonly IDataAdminService _dataAdminService; private readonly IFileReader _fileReader; - + public DataAdminController(IDataAdminService dataAdminService, IFileReader fileReader) { @@ -47,7 +47,7 @@ public IActionResult GetDataSetsList() var response = _dataAdminService.DisplayDataSet(); return StatusCode((int)response.Type, response); } - + [HttpPost("DataSets/Graph")] public async Task DisplayDataSetAsGraph(GetGraphDto getGraphDto) { @@ -63,7 +63,7 @@ public async Task DisplayVertexDetails(string objectId) { var respond = _dataAdminService.GetVertexDetail(objectId); return StatusCode((int)respond.Type, respond); - } + } [HttpGet("DataSets/Edges/{objectId}")] public async Task DisplayEdgeDetails(string objectId) diff --git a/mohaymen-codestar-Team02/Dto/GraphDto/FilterGraphDto.cs b/mohaymen-codestar-Team02/Dto/GraphDto/FilterGraphDto.cs index ef40152..1233a20 100644 --- a/mohaymen-codestar-Team02/Dto/GraphDto/FilterGraphDto.cs +++ b/mohaymen-codestar-Team02/Dto/GraphDto/FilterGraphDto.cs @@ -5,7 +5,7 @@ public class FilterGraphDto public long DatasetId { get; set; } public string SourceIdentifier { get; set; } public string TargetIdentifier { get; set; } - public string VertexIdentifier { get; set; } + public string VertexIdentifier { get; set; } public Dictionary VertexAttributeValues { get; set; } public Dictionary EdgeAttributeValues { get; set; } } \ No newline at end of file diff --git a/mohaymen-codestar-Team02/Dto/GraphDto/GetGraphDto.cs b/mohaymen-codestar-Team02/Dto/GraphDto/GetGraphDto.cs index ff7e47c..1968aad 100644 --- a/mohaymen-codestar-Team02/Dto/GraphDto/GetGraphDto.cs +++ b/mohaymen-codestar-Team02/Dto/GraphDto/GetGraphDto.cs @@ -5,5 +5,5 @@ public class GetGraphDto public long DatasetId { get; set; } public string SourceIdentifier { get; set; } public string TargetIdentifier { get; set; } - public string VertexIdentifier { get; set; } + public string VertexIdentifier { get; set; } } \ No newline at end of file diff --git a/mohaymen-codestar-Team02/Exception/DatabaseExceptionCantFindDataBase.cs b/mohaymen-codestar-Team02/Exception/DatabaseExceptionCantFindDataBase.cs new file mode 100644 index 0000000..245e8b6 --- /dev/null +++ b/mohaymen-codestar-Team02/Exception/DatabaseExceptionCantFindDataBase.cs @@ -0,0 +1,3 @@ +namespace mohaymen_codestar_Team02.Exception; + +public class DatabaseExceptionCantFindDataBase() : ProgramException("cant find Database"); \ No newline at end of file diff --git a/mohaymen-codestar-Team02/Exception/ProgramException.cs b/mohaymen-codestar-Team02/Exception/ProgramException.cs new file mode 100644 index 0000000..9003a27 --- /dev/null +++ b/mohaymen-codestar-Team02/Exception/ProgramException.cs @@ -0,0 +1,8 @@ +namespace mohaymen_codestar_Team02.Exception; + +public class ProgramException : System.Exception +{ + public ProgramException(string? message) : base(message) + { + } +} \ No newline at end of file diff --git a/mohaymen-codestar-Team02/Mapper/AutoMapperProfile.cs b/mohaymen-codestar-Team02/Mapper/AutoMapperProfile.cs index f66a3d7..814d6d2 100644 --- a/mohaymen-codestar-Team02/Mapper/AutoMapperProfile.cs +++ b/mohaymen-codestar-Team02/Mapper/AutoMapperProfile.cs @@ -25,7 +25,9 @@ public AutoMapperProfile() .ForMember(dest => dest.VertexEntity, opt => opt.MapFrom(src => src.VertexEntity)); CreateMap() - .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)); + .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name)) + .ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.DataGroupId)); + CreateMap(); CreateMap(); CreateMap(); diff --git a/mohaymen-codestar-Team02/Services/AnalystService/AnalystService.cs b/mohaymen-codestar-Team02/Services/AnalystService/AnalystService.cs index 3b7e040..0a955b1 100644 --- a/mohaymen-codestar-Team02/Services/AnalystService/AnalystService.cs +++ b/mohaymen-codestar-Team02/Services/AnalystService/AnalystService.cs @@ -3,10 +3,10 @@ using mohaymen_codestar_Team02.Data; using mohaymen_codestar_Team02.Dto; using mohaymen_codestar_Team02.Dto.GraphDTO; +using mohaymen_codestar_Team02.Exception; using mohaymen_codestar_Team02.Models; using mohaymen_codestar_Team02.Models.EdgeEAV; using mohaymen_codestar_Team02.Models.VertexEAV; -using QuikGraph; namespace mohaymen_codestar_Team02.Services.AnalystService; @@ -17,7 +17,8 @@ public class AnalystService : IAnalystService private readonly IEdgeService _edgeService; private readonly IGraphService _graphService; - public AnalystService(IServiceProvider serviceProvider, IVertexService vertexService, IEdgeService edgeService, IGraphService graphService) + public AnalystService(IServiceProvider serviceProvider, IVertexService vertexService, IEdgeService edgeService, + IGraphService graphService) { _serviceProvider = serviceProvider; _vertexService = vertexService; @@ -25,76 +26,67 @@ public AnalystService(IServiceProvider serviceProvider, IVertexService vertexSer _graphService = graphService; } - private DataGroup JoinTheEdgeTable(IQueryable validDataSetTable, GraphQueryInfoDto graphQueryInfoDto) + public async Task> GetTheVertexNeighbor(GraphQueryInfoDto graphQueryInfoDto, + string vertexId) { - var edgeTime = Stopwatch.StartNew(); - var edges = validDataSetTable.Include(s => s.VertexEntity) - .ThenInclude(e => e.VertexAttributes.Where(att => att.Name == graphQueryInfoDto.vertexIdentifier)) - .ThenInclude(att => att.VertexValues).FirstOrDefault(); - edgeTime.Stop(); - Console.WriteLine("it take (" + edgeTime.ElapsedMilliseconds + ") to join th edge table"); - return edges; - } + Console.WriteLine("%%%%%%%&&&&&&&-------------start to Getting the Vertex Neighbor-----------%%%%%%%&&&&&&&\n"); - private (EdgeAttribute sourcesAtt, EdgeAttribute targetAtt) findTargetAtt(DataGroup vertexes, - GraphQueryInfoDto graphQueryInfoDto) - { - EdgeAttribute sourcesAtt = null; - EdgeAttribute targetAtt = null; - var edgeAttList = new List(vertexes.EdgeEntity.EdgeAttributes); - foreach (var att in edgeAttList) - { - if (att.Name.ToLower() == graphQueryInfoDto.sourceIdentifier.ToLower()) - sourcesAtt = att; - else if (att.Name.ToLower() == graphQueryInfoDto.targetIdentifier.ToLower()) targetAtt = att; + var context = GetDbContext(); + if (context == null) throw new DatabaseExceptionCantFindDataBase(); - if (targetAtt is not null && sourcesAtt is not null) return (sourcesAtt, targetAtt); - } + var vertexes = GetVertexes(context, graphQueryInfoDto); + var edges = GetEdges(context, graphQueryInfoDto); + if (vertexes is null || edges is null) throw new DatabaseExceptionCantFindDataBase(); - return (sourcesAtt, targetAtt); + var baseValue = FindBaseValue(vertexes, graphQueryInfoDto, vertexId); + if (baseValue == null) + return new ServiceResponse(null, ApiResponseType.BadRequest, "invalid input for vertex field"); + + var (sourcesAtt, targetAtt) = FindTargetAttributes(vertexes, graphQueryInfoDto); + if (targetAtt == null || sourcesAtt == null) + return new ServiceResponse(null, ApiResponseType.BadRequest, "invalid input for the edge field"); + + var validEdges = GetValidEdges(edges, baseValue, sourcesAtt, targetAtt); + + var (validVertexId, validVertexLabel, validEdgeList) = ProcessValidEdges(context, vertexes, validEdges); + + return CreateResponse(graphQueryInfoDto, validVertexId, validVertexLabel, validEdgeList); } - private DataGroup JoinTheVertexTable(IQueryable validDataSetTable) + private DataContext GetDbContext() { - var vertexTime = Stopwatch.StartNew(); - var vertexes = validDataSetTable.Include(s => s.EdgeEntity) - .ThenInclude(e => e.EdgeAttributes) - .ThenInclude(att => att.EdgeValues).FirstOrDefault(); - vertexTime.Stop(); - Console.WriteLine("it take (" + vertexTime.ElapsedMilliseconds + ") to join th vertex table"); - return vertexes; + var scope = _serviceProvider.CreateScope(); + return scope.ServiceProvider.GetRequiredService(); } - public async Task> GetTheVertexNeighbor(GraphQueryInfoDto graphQueryInfoDto, - string vertexId) + private DataGroup GetVertexes(DataContext context, GraphQueryInfoDto graphQueryInfoDto) { - Console.WriteLine("%%%%%%%&&&&&&&-------------start to Getting the Vertex Neigbor-----------%%%%%%%&&&&&&&\n"); - var time = Stopwatch.StartNew(); - var scope = _serviceProvider.CreateScope(); - var context = scope.ServiceProvider.GetRequiredService(); var validDataSetTable = context.DataSets.Where(ds => ds.DataGroupId == graphQueryInfoDto.datasetId); - var vertexes = JoinTheVertexTable(validDataSetTable); - var edges = JoinTheEdgeTable(validDataSetTable, graphQueryInfoDto); - var BaseValue = vertexes.VertexEntity.VertexAttributes - .FirstOrDefault(att => att.Name == graphQueryInfoDto.vertexIdentifier)! - .VertexValues.FirstOrDefault(value => value.ObjectId == vertexId); - Console.WriteLine("value of the target vertex has been found and its: " + BaseValue.StringValue + "\n"); - if (BaseValue is null) - return new ServiceResponse(null, ApiResponseType.BadRequest, - "invalid input for vertex field"); + return JoinTheVertexTable(validDataSetTable); + } - if (vertexes is null) - return new ServiceResponse(null, ApiResponseType.BadRequest, "database Error"); - var find = findTargetAtt(vertexes, graphQueryInfoDto); - var targetAtt = find.targetAtt; - var sourcesAtt = find.sourcesAtt; + private DataGroup GetEdges(DataContext context, GraphQueryInfoDto graphQueryInfoDto) + { + var validDataSetTable = context.DataSets.Where(ds => ds.DataGroupId == graphQueryInfoDto.datasetId); + return JoinTheEdgeTable(validDataSetTable, graphQueryInfoDto); + } - if (targetAtt is null || sourcesAtt is null) - return new ServiceResponse(null, ApiResponseType.BadRequest, - "invalid input for the edge field"); + private VertexValue FindBaseValue(DataGroup vertexes, GraphQueryInfoDto graphQueryInfoDto, string vertexId) + { + return vertexes.VertexEntity.VertexAttributes + .FirstOrDefault(att => att.Name == graphQueryInfoDto.vertexIdentifier)? + .VertexValues.FirstOrDefault(value => value.ObjectId == vertexId); + } - var validTargetValueList = targetAtt.EdgeValues.Where(val => val.StringValue == BaseValue.StringValue); - var validSourseValueList = sourcesAtt.EdgeValues.Where(val => val.StringValue == BaseValue.StringValue); + private (EdgeAttribute, EdgeAttribute) FindTargetAttributes(DataGroup vertexes, GraphQueryInfoDto graphQueryInfoDto) + { + return findTargetAtt(vertexes, graphQueryInfoDto); + } + + private IEnumerable GetValidEdges(DataGroup edges, VertexValue baseValue, EdgeAttribute sourcesAtt, EdgeAttribute targetAtt) + { + var validTargetValueList = targetAtt.EdgeValues.Where(val => val.StringValue == baseValue.StringValue); + var validSourceValueList = sourcesAtt.EdgeValues.Where(val => val.StringValue == baseValue.StringValue); var validEdgeTarget = validTargetValueList.Select(v => new Edge() { @@ -103,32 +95,33 @@ public async Task> GetTheVertexNeighbor(GraphQu .FirstOrDefault(val => val.ObjectId == v.ObjectId).StringValue, Target = v.StringValue }); - var validEdgeSource = validSourseValueList.Select(v => new Edge() + + var validEdgeSource = validSourceValueList.Select(v => new Edge() { Id = v.ObjectId, Target = edges.EdgeEntity.EdgeAttributes.FirstOrDefault(att => att.Name == targetAtt.Name).EdgeValues .FirstOrDefault(val => val.ObjectId == v.ObjectId).StringValue, Source = v.StringValue }); - var validEdge = validEdgeTarget.Union(validEdgeSource); + + return validEdgeTarget.Union(validEdgeSource); + } + + private (HashSet, List, List) ProcessValidEdges(DataContext context, DataGroup vertexes, IEnumerable validEdge) + { HashSet validVertexId = new(); List validVertexLabel = new(); List validEdges = new(); - var vertexValueList = - new List(context.VertexAttributes.Find(BaseValue.VertexAttributeId)?.VertexValues); - Console.WriteLine("start a big for ........"); - var forTime = Stopwatch.StartNew(); - int i = 0, j = 0, k = 0; + var vertexValueList = new List(context.VertexAttributes.Find(vertexes.VertexEntity.VertexAttributes.First().Id)?.VertexValues); + foreach (var edgeValue in validEdge) { - i++; foreach (var source in vertexValueList) { - j++; if (edgeValue.Source == source.StringValue) + { foreach (var target in vertexValueList) { - k++; if (edgeValue.Target == target.StringValue) { validVertexId.Add(source.ObjectId); @@ -136,37 +129,86 @@ public async Task> GetTheVertexNeighbor(GraphQu validVertexLabel.Add(source.StringValue); validVertexLabel.Add(target.StringValue); validEdges.Add(new Edge() - { Id = edgeValue.Id, Source = source.ObjectId, Target = target.ObjectId }); + { + Id = edgeValue.Id, + Source = source.ObjectId, + Target = target.ObjectId + }); } } + } } } - forTime.Stop(); - Console.WriteLine("finish the huge for and total prosece is : (" + i * j * k + " )"); - Console.WriteLine("time that take that to finish the for : " + forTime.ElapsedMilliseconds + ""); + return (validVertexId, validVertexLabel, validEdges); + } - var idList = new List(validVertexId); + private ServiceResponse CreateResponse(GraphQueryInfoDto graphQueryInfoDto, HashSet validVertexId, List validVertexLabel, List validEdges) + { + var idList = validVertexId.ToList(); if (validVertexId.Count != validVertexLabel.Count) - return new ServiceResponse(null, ApiResponseType.InternalServerError, - "dont have sink output"); + return new ServiceResponse(null, ApiResponseType.InternalServerError, "don't have sink output"); List resultVertex = new(); for (var l = 0; l < validVertexId.Count; l++) + { resultVertex.Add(new Vertex() { Id = idList[l], Label = validVertexLabel[l] }); + } - Console.WriteLine("finish the creating of vertex"); var responseData = new DisplayGraphDto() - { GraphId = graphQueryInfoDto.datasetId, Edges = validEdges, Vertices = resultVertex }; - time.Stop(); - Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@ that take (" + time.ElapsedMilliseconds + - ") milieSec to find the VertexNeighbor @@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + { + GraphId = graphQueryInfoDto.datasetId, + Edges = validEdges, + Vertices = resultVertex + }; + return new ServiceResponse(responseData, ApiResponseType.Success, string.Empty); } - + + private DataGroup JoinTheEdgeTable(IQueryable validDataSetTable, GraphQueryInfoDto graphQueryInfoDto) + { + var edgeTime = Stopwatch.StartNew(); + var edges = validDataSetTable.Include(s => s.VertexEntity) + .ThenInclude(e => e.VertexAttributes.Where(att => att.Name == graphQueryInfoDto.vertexIdentifier)) + .ThenInclude(att => att.VertexValues).FirstOrDefault(); + edgeTime.Stop(); + Console.WriteLine("it takes (" + edgeTime.ElapsedMilliseconds + ") ms to join the edge table"); + return edges; + } + + private DataGroup JoinTheVertexTable(IQueryable validDataSetTable) + { + var vertexTime = Stopwatch.StartNew(); + var vertexes = validDataSetTable.Include(s => s.EdgeEntity) + .ThenInclude(e => e.EdgeAttributes) + .ThenInclude(att => att.EdgeValues).FirstOrDefault(); + vertexTime.Stop(); + Console.WriteLine("it takes (" + vertexTime.ElapsedMilliseconds + ") ms to join the vertex table"); + return vertexes; + } + + private (EdgeAttribute sourcesAtt, EdgeAttribute targetAtt) findTargetAtt(DataGroup vertexes, + GraphQueryInfoDto graphQueryInfoDto) + { + EdgeAttribute sourcesAtt = null; + EdgeAttribute targetAtt = null; + var edgeAttList = new List(vertexes.EdgeEntity.EdgeAttributes); + foreach (var att in edgeAttList) + { + if (att.Name.ToLower() == graphQueryInfoDto.sourceIdentifier.ToLower()) + sourcesAtt = att; + else if (att.Name.ToLower() == graphQueryInfoDto.targetIdentifier.ToLower()) targetAtt = att; + + if (targetAtt is not null && sourcesAtt is not null) return (sourcesAtt, targetAtt); + } + + return (sourcesAtt, targetAtt); + } + public async Task> DisplayGeraphData(long databaseId, string sourceEdgeIdentifierFieldName, - string destinationEdgeIdentifierFieldName, string vertexIdentifierFieldName, Dictionary vertexAttributeValus, Dictionary edgeAttributeValues) + string destinationEdgeIdentifierFieldName, string vertexIdentifierFieldName, + Dictionary vertexAttributeValus, Dictionary edgeAttributeValues) { var vertices = _vertexService.GetAllVertices(databaseId, vertexIdentifierFieldName, vertexAttributeValus); var edges = _edgeService.GetAllEdges(databaseId, sourceEdgeIdentifierFieldName, @@ -182,7 +224,7 @@ public async Task> DisplayGeraphData(long datab return new ServiceResponse(dto, ApiResponseType.Success, Resources.GraphFetchedSuccessfullyMessage); } - + public ServiceResponse> GetVertexAttributes(long vertexEntityId) { var att = _vertexService.GetVertexAttributes(vertexEntityId); @@ -194,5 +236,4 @@ public ServiceResponse> GetEdgeAttributes(long edgeEntityI var att = _edgeService.GetEdgeAttributes(edgeEntityId); return new ServiceResponse>(att, ApiResponseType.Success, ""); } - -} \ No newline at end of file +} diff --git a/mohaymen-codestar-Team02/Services/AnalystService/IAnalystService.cs b/mohaymen-codestar-Team02/Services/AnalystService/IAnalystService.cs index 7a69b48..a6bf480 100644 --- a/mohaymen-codestar-Team02/Services/AnalystService/IAnalystService.cs +++ b/mohaymen-codestar-Team02/Services/AnalystService/IAnalystService.cs @@ -12,7 +12,7 @@ Task> DisplayGeraphData(long databaseId, string sourceEdgeIdentifierFieldName, string destinationEdgeIdentifierFieldName, string vertexIdentifierFieldName, Dictionary vertexAttributeValus, Dictionary edgeAttributeValues); - + ServiceResponse> GetVertexAttributes(long vertexEntityId); ServiceResponse> GetEdgeAttributes(long edgeEntityId); diff --git a/mohaymen-codestar-Team02/Services/DataAdminService/DataAdminService.cs b/mohaymen-codestar-Team02/Services/DataAdminService/DataAdminService.cs index caed92b..13663dd 100644 --- a/mohaymen-codestar-Team02/Services/DataAdminService/DataAdminService.cs +++ b/mohaymen-codestar-Team02/Services/DataAdminService/DataAdminService.cs @@ -97,9 +97,9 @@ public async Task> DisplayGeraphData(long datab string sourceEdgeIdentifierFieldName, string destinationEdgeIdentifierFieldName, string vertexIdentifierFieldName) { - var vertices = _vertexService.GetAllVertices(databaseId, vertexIdentifierFieldName, new Dictionary(){}); + var vertices = _vertexService.GetAllVertices(databaseId, vertexIdentifierFieldName, new Dictionary() { }); var edges = _edgeService.GetAllEdges(databaseId, sourceEdgeIdentifierFieldName, - destinationEdgeIdentifierFieldName, new Dictionary(){}); + destinationEdgeIdentifierFieldName, new Dictionary() { }); var graph = _graphService.GetGraph(vertices, edges, vertexIdentifierFieldName, sourceEdgeIdentifierFieldName, destinationEdgeIdentifierFieldName); diff --git a/mohaymen-codestar-Team02/Services/GraphService/GraphService.cs b/mohaymen-codestar-Team02/Services/GraphService/GraphService.cs index 69a1574..cd0a729 100644 --- a/mohaymen-codestar-Team02/Services/GraphService/GraphService.cs +++ b/mohaymen-codestar-Team02/Services/GraphService/GraphService.cs @@ -109,16 +109,16 @@ private void GetSourceAndDerstinationValues(string sourceEdgeIdentifierFieldName if (!dicVertices.TryGetValue(targetValue, out targets)) continue; foreach (var source in sources) - foreach (var target in targets) - { - var newEdge = new Edge() + foreach (var target in targets) { - Id = edge.Key, - Source = source.Key, - Target = target.Key - }; - resEdges.Add(newEdge); - } + var newEdge = new Edge() + { + Id = edge.Key, + Source = source.Key, + Target = target.Key + }; + resEdges.Add(newEdge); + } } return (resVertices, resEdges); diff --git a/mohaymen-codestar-Team02/Services/StoreData/VertexStorerCsv.cs b/mohaymen-codestar-Team02/Services/StoreData/VertexStorerCsv.cs index 9c2d193..911b7db 100644 --- a/mohaymen-codestar-Team02/Services/StoreData/VertexStorerCsv.cs +++ b/mohaymen-codestar-Team02/Services/StoreData/VertexStorerCsv.cs @@ -66,7 +66,7 @@ public async Task StoreFileData(string entityName, string dataFile, long d await dataContext.SaveChangesAsync(); return true; } - catch (Exception e) + catch (System.Exception e) { return false; } diff --git a/mohaymen-codestar-Team02_XUnitTest/Services/AnalystService/AnalystServiceTest.cs b/mohaymen-codestar-Team02_XUnitTest/Services/AnalystService/AnalystServiceTest.cs index 2e62306..4b3936f 100644 --- a/mohaymen-codestar-Team02_XUnitTest/Services/AnalystService/AnalystServiceTest.cs +++ b/mohaymen-codestar-Team02_XUnitTest/Services/AnalystService/AnalystServiceTest.cs @@ -1,45 +1,127 @@ -// using Microsoft.EntityFrameworkCore; -// using Microsoft.Extensions.DependencyInjection; -// using mohaymen_codestar_Team02.Data; -// using mohaymen_codestar_Team02.Dto; -// using mohaymen_codestar_Team02.Models; -// using mohaymen_codestar_Team02.Models.EdgeEAV; -// using mohaymen_codestar_Team02.Models.VertexEAV; -// using mohaymen_codestar_Team02.Services.DataAdminService; -// -// namespace mohaymen_codestar_Team02_XUnitTest.Servies.AnalystService; -// -// public class AnalystServiceTest -// { -// private readonly mohaymen_codestar_Team02.Services.AnalystService.AnalystService _sut; -// private readonly IServiceProvider _serviceProvider; -// private readonly IDataAdminService _dataAdminService; -// -// public AnalystServiceTest() -// { -// var serviceCollection = new ServiceCollection(); -// -// var options = new DbContextOptionsBuilder() -// .UseInMemoryDatabase(Guid.NewGuid().ToString()) -// .Options; -// -// serviceCollection.AddScoped(_ => new DataContext(options)); -// _serviceProvider = serviceCollection.BuildServiceProvider(); -// _dataAdminService = _serviceProvider.GetRequiredService(); -// _sut = new mohaymen_codestar_Team02.Services.AnalystService.AnalystService(_serviceProvider); -// } -// -// [Fact] -// public async Task GetTheVertexNeighbor_ShouldReturnValidResponse_WhenValidData() -// { -// var response = await _dataAdminService.StoreData( -// "\"SourceAcount\",\"DestiantionAccount\",\"Amount\",\"Date\",\"TransactionID\",\"Type\"\n\"6534454617\",\"6039548046\",\"500,000,000\",\"1399/04/23\",\"153348811341\",\"پایا\"\n\"6039548046\",\"5287517379\",\"100,000,000\",\"1399/04/23\",\"192524206627\",\"پایا\"\n\"6039548046\",\"5718373092\",\"200,000,000\",\"1399/04/27\",\"113480622054\",\"پایا\"\n\"6039548046\",\"9862369812\",\"300,000,000\",\"1399/04/28\",\"114556773378\",\"پایا\"\n\"5287517379\",\"1205418051\",\"50,000,000\",\"1399/04/29\",\"185136982986\",\"کارت به کارت\"\n\"9862369812\",\"3714493428\",\"350,000,000\",\"1399/04/30\",\"197303042408\",\"پایا\"\n\"5718373092\",\"3714493428\",\"2,000,000,000\",\"1399/04/31\",\"173993949660\",\"ساتنا\"\n\"1205418051\",\"7434776097\",\"800,000,000\",\"1399/04/31\",\"107213392290\",\"پایا\"\n\"3714493428\",\"7434776097\",\"1,000,000,000\",\"1399/04/31\",\"131554897007\",\"ساتنا\"\n\"4727992815\",\"7434776097\",\"2,000,000,000\",\"1399/05/01\",\"163090175418\",\"ساتنا\"\n\"7434776097\",\"3084026274\",\"4,000,000,000\",\"1399/05/02\",\"126328028392\",\"ساتنا\"\n\"4727992815\",\"3084026274\",\"200,000,000\",\"1399/05/03\",\"133232291681\",\"پایا\"\n", -// "\"AccountID\",\"CardID\",\"IBAN\",\"AccountType\",\"BranchTelephone\",\"BranchAdress\",\"BranchName\",\"OwnerName\",\"OwnerLastName\",\"OwnerID\"\n\"6534454617\",\"6104335000000190\",\"IR120778801496000000198\",\"پس انداز\",\"55638667\",\"تهران-خیابان خیام-بالاتر از چهارراه گلوبندک\",\"گلوبندک\",\"افسر\",\"طباطبایی\",\"1227114110\"\n\"4000000028\",\"6037699000000020\",\"IR033880987114000000028\",\"سپرده\",\"77547230\",\"تهران-خيابان شهيد مدنی-نبش خيابان اميرشرفی\",\"امیر شرفی\",\"ایرج\",\"مددی\",\"3658507956\"\n\"3000000406\",\"6221060000000400\",\"IR248204855973000000406\",\"سپرده\",\"22760489\",\"تهران-خيابان دولت-خيابان ديباجی جنوبی-نبش خيابان شهيد عرفاتی-شماره 82\",\"ديباجی جنوبی\",\"ترانه\",\"برزگری\",\"0233079137\"\n\"4000000290\",\"6219867000000290\",\"IR806364680364000000290\",\"جاری\",\"22960013\",\"تهران-چهارراه پاسداران-میدان حسین\u200cآباد-ساختمان مهدی-پلاک 120\",\"میدان حسین آباد\",\"ترمه\",\"نصیری\",\"3472758002\"\n\"6039548046\",\"6104333000000360\",\"IR437427012782000000361\",\"پس انداز\",\"33502628\",\"تهران-خیابان ری-نرسیده به سه\u200c راه امین حضور-جنب کوچه آبشار\",\"آبشار\",\"ارژنگ\",\"مرتضوی\",\"8260281348\"\n\"9000000331\",\"6221062000000330\",\"IR382666702669000000331\",\"پس انداز\",\"22237244\",\"تهران-خيابان شريعتی-خيابان موسی وند-خيابان کريمی-شماره 151\",\"خيابان بوعلی\",\"تینا\",\"اشتیانی\",\"9650799964\"\n\"2000000307\",\"5028064000000300\",\"IR515705817182000000307\",\"سپرده\",\"77728343\",\"تهران-تهرانپارس-خیابان رشید-نبش کوچه 148 غربی-پلاک 119\",\"تهرانپارس - رشید\",\"ارین\",\"نجفی\",\"2383698300\"\n\"3000000352\",\"6104335000000350\",\"IR447139041943000000352\",\"جاری\",\"55898061\",\"تهران-خیابان 15 خرداد-بازار عباس آباد-سرای آزادی-طبقه دوم\",\"سرای آزادی\",\"حمید\",\"یثربی\",\"1782886202\"\n\"8000000459\",\"6395999000000450\",\"IR999469685408000000459\",\"جاری\",\"77227190\",\"تهران-خیابان فرجام شرقی-بین سراج و چهارراه ولیعصر-جنب گزینش ناجا-پلاک 1/514\",\"فرجام شرقی\",\"خسرو\",\"صفوی\",\"5674868748\"\n\"8000000402\",\"6393468000000400\",\"IR666786156808000000402\",\"جاری\",\"66571376\",\"تهران-خیابان امیر آباد شمالی-روبروی پمپ بنزین-نبش کوچه اشراقی\",\"امیر آباد شمالی\",\"دارا\",\"زمان زاده\",\"6935043332\"\n\"5287517379\",\"6219867000000430\",\"IR768572504519000000439\",\"سپرده\",\"55481172\",\"تهران-خيابان کارگرجنوبی-ضلع شمال شرقی ميدان قزوين-پلاک 18\",\"میدان قزوین\",\"دریا\",\"حسین زاده\",\"9823618218\"\n\"9862369812\",\"6104336000000280\",\"IR555340066618000000280\",\"جاری\",\"88556268\",\"تهران-خیابان شهید مطهری-نرسیده به خیابان قائم مقام فراهانی-پلاک 257\",\"استاد مطهری\",\"کامران\",\"رضایی\",\"2684955349\"\n\"5718373092\",\"6221065000000320\",\"IR254972538744000000320\",\"پس انداز\",\"66362188\",\"تهران-خيابان آزادی-نبش خيابان آذربايجان-شماره 332\",\"آزادی\",\"کیانوش\",\"قاضی\",\"1181323213\"\n\"1205418051\",\"6104332000000060\",\"IR782956669947000000060\",\"سپرده\",\"33769073\",\"تهران-شهرری-شهرک دولت آباد-فلکه اول\",\"دولت آباد\",\"ژیلا\",\"زمان زاده\",\"4398373386\"\n\"1000000236\",\"6037697000000230\",\"IR311031297571000000236\",\"جاری\",\"55707330\",\"تهران-خیابان قزوین-نرسیده به دو راهی قپان-پلاک 843\",\"امین الملک\",\"ساناز\",\"حسن پور\",\"8655501965\"\n\"3714493428\",\"6280233000000450\",\"IR590757191926000000453\",\"سپرده\",\"55746611\",\"تهران-خیابان قزوین-دوراهی\u200cقپان-خیابان فرهنگ-پلاک 945\",\"اذری\",\"ستایش\",\"سالاری\",\"8083189094\"\n\"7000000069\",\"5041728000000060\",\"IR537707653587000000069\",\"پس انداز\",\"33136732\",\"تهران-خیابان 17 شهریور-پایین تر از پل آهنگ-پلاک 954\",\"17شهریور\",\"نقی\",\"طباطبایی\",\"7518497901\"\n\"4727992815\",\"5028064000000040\",\"IR129871182765000000045\",\"جاری\",\"55601544\",\"تهران-خیابان مولوی غربی-بعد از میدان محمدیه-پلاک 744\",\"مولوی غربی\",\"نگار\",\"احمدی\",\"1247145263\"\n\"9000000487\",\"5028066000000480\",\"IR541008141089000000487\",\"سپرده\",\"66067052\",\"تهران-خیابان آزادی-ما بین خیابان شهیدان و خیابان جیحون-ابتدای کوچه مشعوف-پلاک 378\",\"آزادی - یادگار\",\"مهتاب\",\"قاضی\",\"0466444575\"\n\"7434776097\",\"6219869000000180\",\"IR955348247339000000184\",\"سپرده\",\"22234427\",\"تهران-بلوار 35 متری قیطریه-روبروی پارک قیطریه-پلاک 85\",\"قیطریه\",\"بامداد\",\"برزگری\",\"7333935716\"\n\"7000000021\",\"6037999000000020\",\"IR357530402617000000021\",\"جاری\",\"55000069\",\"تهران-خانی آباد نو-خیابان شهرداری-نبش خیابان مینا\",\"خانی آباد نو\",\"بهناز\",\"اشتیانی\",\"3184365126\"\n\"3084026274\",\"6104333000000000\",\"IR378370321425000000008\",\"پس انداز\",\"66057406\",\"تهران-خیابان آزادی-مقابل دانشگاه صنعتی شریف-نبش کوچه حیدرتاش-پلاک 240\",\"آزادی\",\"انوش\",\"ابراهیمی\",\"2746339440\"\n\"4000000400\",\"5028063000000400\",\"IR508577914084000000400\",\"جاری\",\"88717727\",\"تهران-خیابان احمد قصیر-بین خیابان پنجم و خیابان هفتم-پلاک 16\",\"احمد قصیر\",\"پرهام\",\"عسگرپور\",\"5125488187\"\n\"1000000358\",\"5028067000000350\",\"IR463499058601000000358\",\"سپرده\",\"56696077\",\"تهران-اسلامشهر-ابتدای بیست متری امام خمینی (ره)-جنب مسجد امام نقی(ع)\",\"اسلامشهر\",\"پیروز\",\"شکاری\",\"9710095137\"\n\"8000000190\",\"6221064000000190\",\"IR401698532368000000190\",\"جاری\",\"46889990\",\"تهران-بلوار انقلاب-نبش خيابان کشاورز\",\"شهر قدس\",\"مانی\",\"عبدلی\",\"8320298705\"\n\"9000000405\",\"6395995000000400\",\"IR500379357299000000405\",\"پس انداز\",\"22844370\",\"تهران-خیابان خواجه عبدالله انصاری-نبش کوچه ششم-پلاک 110\",\"خواجه عبدالله انصاری\",\"شیرین\",\"ابراهیم نژاد\",\"4031019294\"\n", -// "test", -// "transaction", "account"); -// using var scope = _serviceProvider.CreateScope(); -// var dataContext = scope.ServiceProvider.GetRequiredService(); -// Console.WriteLine(dataContext.DataSets); -// } -// } +using Microsoft.Extensions.DependencyInjection; +using mohaymen_codestar_Team02.Data; +using mohaymen_codestar_Team02.Dto; +using mohaymen_codestar_Team02.Dto.GraphDTO; +using mohaymen_codestar_Team02.Models; +using mohaymen_codestar_Team02.Services; +using NSubstitute; +namespace mohaymen_codestar_Team02_XUnitTest.Services.AnalystService; + +public class AnalystServiceTest +{ + private readonly mohaymen_codestar_Team02.Services.AnalystService.AnalystService _sut; + private readonly IVertexService _vertexService; + private readonly IEdgeService _edgeService; + private readonly IGraphService _graphService; + + public AnalystServiceTest() + { + var serviceCollection = new ServiceCollection(); + serviceCollection.AddScoped(_ => Substitute.For()); + var serviceProvider = serviceCollection.BuildServiceProvider(); + + _vertexService = Substitute.For(); + _edgeService = Substitute.For(); + _graphService = Substitute.For(); + + _sut = new mohaymen_codestar_Team02.Services.AnalystService.AnalystService(serviceProvider, _vertexService, _edgeService, _graphService); + } + + [Fact] + public async Task DisplayGeraphData_ShouldReturnCorrectData_WhenDataIsValid() + { + // Arrange + var databaseId = 1L; + var sourceField = "sourceId"; + var destinationField = "targetId"; + var vertexField = "vertexId"; + var vertexAttributes = new Dictionary { { "attr1", "value1" } }; + var edgeAttributes = new Dictionary { { "attr1", "value1" } }; + + var vertices = new Dictionary> + { + { "vertex1", new Dictionary { { "attr1", "value1" } } } + }; + + var edges = new Dictionary> + { + { "edge1", new Dictionary { { "source", "vertex1" }, { "target", "vertex2" } } } + }; + + var graph = new DisplayGraphDto + { + Vertices = new List { new Vertex { Id = "vertex1", Label = "Label1" } }, + Edges = new List { new Edge { Id = "edge1", Source = "vertex1", Target = "vertex2" } } + }; + + _vertexService.GetAllVertices(databaseId, vertexField, vertexAttributes) + .Returns(vertices); + + _edgeService.GetAllEdges(databaseId, sourceField, destinationField, edgeAttributes) + .Returns(edges); + + _graphService.GetGraph(vertices, edges, vertexField, sourceField, destinationField) + .Returns((graph.Vertices, graph.Edges)); + + // Act + var result = await _sut.DisplayGeraphData(databaseId, sourceField, destinationField, vertexField, vertexAttributes, edgeAttributes); + + // Assert + Assert.NotNull(result); + Assert.Equal(ApiResponseType.Success, result.Type); + Assert.NotNull(result.Data); + Assert.Single(result.Data!.Vertices); + Assert.Equal("vertex1", result.Data.Vertices.First().Id); + Assert.Single(result.Data.Edges); + Assert.Equal("vertex1", result.Data.Edges.First().Source); + } + + [Fact] + public void GetVertexAttributes_ShouldReturnCorrectAttributes() + { + // Arrange + var vertexEntityId = 1L; + var attributes = new List + { + new GetAttributeDto { Id = 1, Name = "Attribute1" } + }; + + _vertexService.GetVertexAttributes(vertexEntityId) + .Returns(attributes); + + // Act + var result = _sut.GetVertexAttributes(vertexEntityId); + + // Assert + Assert.NotNull(result); + Assert.Equal(ApiResponseType.Success, result.Type); + Assert.NotNull(result.Data); + Assert.Single(result.Data); + Assert.Equal("Attribute1", result.Data.First().Name); + } + + [Fact] + public void GetEdgeAttributes_ShouldReturnCorrectAttributes() + { + // Arrange + var edgeEntityId = 1L; + var attributes = new List + { + new GetAttributeDto { Id = 1, Name = "Attribute1" } + }; + + _edgeService.GetEdgeAttributes(edgeEntityId) + .Returns(attributes); + + // Act + var result = _sut.GetEdgeAttributes(edgeEntityId); + + // Assert + Assert.NotNull(result); + Assert.Equal(ApiResponseType.Success, result.Type); + Assert.NotNull(result.Data); + Assert.Single(result.Data); + Assert.Equal("Attribute1", result.Data.First().Name); + } +} \ No newline at end of file diff --git a/mohaymen-codestar-Team02_XUnitTest/Services/ProfileService/ProfileServiceTest.cs b/mohaymen-codestar-Team02_XUnitTest/Services/ProfileService/ProfileServiceTest.cs index ee465a9..5f4c0a8 100644 --- a/mohaymen-codestar-Team02_XUnitTest/Services/ProfileService/ProfileServiceTest.cs +++ b/mohaymen-codestar-Team02_XUnitTest/Services/ProfileService/ProfileServiceTest.cs @@ -119,7 +119,7 @@ public async Task UpdateUser_ShouldReturnUnauthorized_WhenCookieIsEmpty() { // Arrange var updateUserDto = new UpdateUserDto - { FirstName = "NewFirstName", LastName = "NewLastName", Email = "newemail@example.com" }; + { FirstName = "NewFirstName", LastName = "NewLastName", Email = "newemail@example.com" }; _cookieService.GetCookieValue().Returns(string.Empty); // Act @@ -134,7 +134,7 @@ public async Task UpdateUser_ShouldReturnBadRequest_WhenUserNotFound() { // Arrange var updateUserDto = new UpdateUserDto - { FirstName = "NewFirstName", LastName = "NewLastName", Email = "newemail@example.com" }; + { FirstName = "NewFirstName", LastName = "NewLastName", Email = "newemail@example.com" }; _cookieService.GetCookieValue().Returns("validToken"); _tokenService.GetUserNameFromToken().Returns("nonexistentUser"); @@ -154,7 +154,7 @@ public async Task UpdateUser_ShouldReturnSuccess_WhenUserIsUpdated() _tokenService.GetUserNameFromToken().Returns("existingUser"); var updateUserDto = new UpdateUserDto - { FirstName = "NewFirstName", LastName = "NewLastName", Email = "newemail@example.com" }; + { FirstName = "NewFirstName", LastName = "NewLastName", Email = "newemail@example.com" }; // Act var result = await _sut.UpdateUser(updateUserDto); diff --git a/mohaymen-codestar-Team02_XUnitTest/Services/StoreData/StoreDataServiceTest.cs b/mohaymen-codestar-Team02_XUnitTest/Services/StoreData/StoreDataServiceTest.cs index 9987f1f..393377a 100644 --- a/mohaymen-codestar-Team02_XUnitTest/Services/StoreData/StoreDataServiceTest.cs +++ b/mohaymen-codestar-Team02_XUnitTest/Services/StoreData/StoreDataServiceTest.cs @@ -37,7 +37,7 @@ public async Task StoreDataSet_ShouldStoreTheData_whenDataIsVilid() //Arrange var name = "mahdi"; mockContext.Users.Add(new User() - { Username = "3", UserId = 4, PasswordHash = Array.Empty(), Salt = Array.Empty() }); + { Username = "3", UserId = 4, PasswordHash = Array.Empty(), Salt = Array.Empty() }); mockContext.SaveChanges(); //Act var bolResult = await _sut.StoreDataSet(name, "3");