N
N
nutakoy2020-05-22 10:38:54
C++ / C#
nutakoy, 2020-05-22 10:38:54

C# in VS and VS Code: how to open another .cs in the same project?

So I created a project in VS or VS Code, there is a .cs file that is launched by the run command. How can I run another file of the same format without creating a separate project for it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-05-22
@firedragon

The assembly unit is the project. He starts up.
If you need to run code in multiple places, select a project of type "Test"
Then you can run individual tests
https://docs.microsoft.com/en-us/dotnet/core/testi...
Below is an example of a purely utilitarian test, if all "green", then the servers are working

#region License
// // Разработано: Коротенко Владимиром Николаевичем (Vladimir N. Korotenko)
// // email: [email protected]
// // skype:vladimir-korotenko
// // https://vkorotenko.ru
// // Создано:  26.04.2020 10:26
#endregion

using Newtonsoft.Json;
using SpecialForcesDirectory.Code;
using System.Threading.Tasks;
using SpecialForcesDirectory.Dbl;
using Xunit;

namespace SpecialForcesDirectory.Test
{
    public class LocalizationResourceTests
    {
        [Fact]
        public async Task GetRussianQuotePageTest()
        {
            var url = "https://test.ru/offlineapp/quotaservice.php";
            await GetData(url);
        }

        private async Task<Quote[]> GetData(string url)
        {
            var da = new LoadDataAdapter();
            var json = await da.GetJson(url);
            return JsonConvert.DeserializeObject<Quote[]>(json, new JsonBooleanConverter());
        }
        [Fact]
        public async Task GetEnglishQuotePageTest()
        {
            var url = "https://en.test.ru/offlineapp/quotaservice.php";
            await GetData(url);
        }
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question