namespace UnitTestsEntities; using Xunit; using System.Linq; using Entities; using Microsoft.EntityFrameworkCore; public class DataSourceEntityTests { [Fact] public void Add_DataSource_Success() { var dataSource = new DataSourceEntity { Type = "GPS", Model = "Garmin Forerunner 945", Precision = 0.1f }; /* using (var context = new StubbedContext(options)) { context.Database.EnsureCreated(); context.DataSources.Add(dataSource); context.SaveChanges(); } using (var context = new StubbedContext(options)) { var savedDataSource = context.DataSources.First(d => d.Type == "GPS"); Assert.NotNull(savedDataSource); Assert.Equal("Garmin Forerunner 945", savedDataSource.Model); }*/ } [Fact] public void Update_DataSource_Success() { var dataSource = new DataSourceEntity { Type = "Heart Rate Monitor", Model = "Polar H10", Precision = 0.2f }; /* using (var context = new StubbedContext(options)) { context.Database.EnsureCreated(); context.DataSources.Add(dataSource); context.SaveChanges(); } using (var context = new StubbedContext(options)) { var savedDataSource = context.DataSources.First(d => d.Type == "Heart Rate Monitor"); savedDataSource.Model = "Polar H9"; context.SaveChanges(); } using (var context = new StubbedContext(options)) { var updatedDataSource = context.DataSources.First(d => d.Model == "Polar H9"); Assert.NotNull(updatedDataSource); Assert.Equal("Heart Rate Monitor", updatedDataSource.Type); Assert.Equal(0.2f, updatedDataSource.Precision); }*/ } [Fact] public void Delete_DataSource_Success() { var dataSource = new DataSourceEntity { Type = "Smartwatch", Model = "Apple Watch Series 6", Precision = 0.05f }; /* using (var context = new StubbedContext(options)) { context.Database.EnsureCreated(); context.DataSources.Add(dataSource); context.SaveChanges(); } using (var context = new StubbedContext(options)) { var savedDataSource = context.DataSources.First(d => d.Type == "Smartwatch"); context.DataSources.Remove(savedDataSource); context.SaveChanges(); } using (var context = new StubbedContext(options)) { var deletedDataSource = context.DataSources.FirstOrDefault(d => d.Type == "Smartwatch"); Assert.Null(deletedDataSource); }*/ } }