Skip to content

Conversation

@naanaowusu
Copy link

There are several assertions i added

@Anisimova2020 Anisimova2020 self-requested a review March 7, 2023 06:08
--name=postgres \
-e POSTGRES_shared_buffers=${DB_POSTGRES_shared_buffers} \
-p 5432:5432 \
-p 5433:5432 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be commited.

image: flexberry/alt.p8-postgresql
ports:
- 5432:5432
- 5433:5432
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be commited.

<connectionStrings>
<!-- Please set up your own database connection strings before you run integrated tests. -->
<add name="ConnectionStringPostgres" connectionString="" />
<add name="ConnectionStringPostgres" connectionString="SERVER=localhost;User ID=postgres;Password=p@ssw0rd;Port=5433;" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not be commited.

using System;
using System.Collections.Generic;

using System.Diagnostics;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this using added here for?

ds.ExecuteNonQuery(query2);
ds.ExecuteNonQuery(query3);

Assert.DoesNotContain(query0, "LEFT JOIN");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для чистоты эксперимента нужно делать query0.ToUpper() и аналогично ниже.

Assert.Equal("A", ((OrderedCls)entrysl.Value).Name);
}

// Assert.Equal("A", ((OrderedCls)((DictionaryEntry)myValueList[0]).Value).Name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't commit commented code.

Console.WriteLine(((OrderedCls)((DictionaryEntry)cls).Value).Name);
}

IList myOrderList = sl.GetKeyList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i remember we planned to add asserts on LST, BSS, S1 to this method.

image: flexberry/alt.p8-postgresql-postgis
ports:
- 5432:5432
- 5433:5432
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not commit this.

@@ -0,0 +1,12 @@
version: '3.2'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be commited to server.


var v = new View(new ViewAttribute("AllProps", new string[] { "*" }), typeof(Кошка));
View v = new View(new ViewAttribute("AllProps", new string[] { "*" }), typeof(Кошка));
var ob = ds.LoadObjects(v);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var стоит заменить на реальный тип.
Проверить, что "ob" не NULL и проверить количество элементов (через Assert).

View plantView = Plant2.Views.Plant2E;

IQueryable<Plant2> plant2s = ds.Query<Plant2>(plantView)
.Where(x => x.__PrimaryKey == cls1.__PrimaryKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В конце этой конструкции нужно добавить ToList(); Тогда plant2s будет типа List.

После этого нужно сделать не только
Assert.NotNull(plant2s);, но и Assert.Equal(..., plant2s.Length)

{
using System;
using System.Diagnostics;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь эта строка нужная.
Using, которые начинаются с System, отделяются от остальных пустой строчкой.

ds.ExecuteNonQuery(query2);
ds.ExecuteNonQuery(query3);

Assert.DoesNotContain(query0.ToUpper(), "LEFT JOIN");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DoesNotContain(expectedSubString, actualString) (https://metanit.com/sharp/aspnet5/22.3.php)

Это значит, что первый параметр - это подстрока, а второй - строка, где мы ищем эту подстроку. Соответственно, нужно

Assert.DoesNotContain("LEFT JOIN", query0.ToUpper())

str = Nullable.GetUnderlyingType(tBool).FullName;
Console.WriteLine(str);
Console.WriteLine(Nullable.GetUnderlyingType(typeof(int)) == null ? "null" : Nullable.GetUnderlyingType(typeof(int)).FullName);
Assert.Null(Nullable.GetUnderlyingType(typeof(int)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше "Nullable.GetUnderlyingType(typeof(int))" в отдельную переменную, а потом использовать в строчках:

Console.WriteLine(Nullable.GetUnderlyingType(typeof(int)) == null ? "null" : Nullable.GetUnderlyingType(typeof(int)).FullName);
Assert.Null(Nullable.GetUnderlyingType(typeof(int)));

DataObject[] ob = ds.LoadObjects(v);
Assert.NotNull(ob);

var l = ds.Query<Медведь>(Медведь.Views.МедведьE).Where(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сразу замени var на реальный тип.


View plantView = Plant2.Views.Plant2E;

IQueryable<Plant2> plant2s = ds.Query<Plant2>(plantView)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not understand.

"IQueryable plant2s = ds.Query(plantView).Where(x => x.__PrimaryKey == cls1.__PrimaryKey);"

and

"Plant2 cl = new Plant2();
cl.SetExistObjectPrimaryKey(cls1.__PrimaryKey);
ds.LoadObject(plantView, cl);
Assert.NotNull(cl);"

make the same. What for is there two same checks? Only one should be.


View cabbageView = Cabbage2.Views.Cabbage2E;

IQueryable<Cabbage2> cabbage2s = ds.Query<Cabbage2>(cabbageView)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants