- Request a raise to get additional motivation to work
- Require a vacation to take a break from boring tasks and gain strength.
- Change jobs by posting your resume in the hope that you will receive an offer that will satisfy you.
If you still chose the third option, then you did what I did. And I received a dream offer: my own stack (lately, I was forced to change my favorite C #, to php, and also the bitrix framework), fintech, and with a salary increase. Of course, first of all, I decided to update my knowledge. This text is, first of all, my cheat sheet, compiled from the vacancy text for the position of Middle .NET Engineer of my dreams.
ORM - Entity Framework / NHibernate
Entity framework and NHibernate are frameworks that use ORM (object-oriented mapping (mapping) technology to map objects (classes) to tables in the database. That is, ORM, conditionally, is a layer between the code and the database that allows objects created in the program add / receive to / from the database.
Pros of EF
- Allows you to create a table by code or using EF Designer and generate a new database
- You can "automate" the creation of objects, as well as track changes to these objects, thus simplifying the process of updating the database
- Using a single syntax (LINQ) for any collections of objects, be it data from a database, or just a list; it is fast enough, if used correctly, and also reasonably laconic.
- EF can replace huge chunks of code that you would write yourself.
- Reduces development time.
- Supports asynchronous database operations.
Cons of EF
- Using an "unconventional" approach to data processing that is not available with every database.
- For any change in the database schema, EF will refuse to work; changes to the code are required.
- The SQL code is generated in an uncontrolled way, we must trust the developers of EF itself.
- .
NHibernate
- .
- .
- Unit Of Work.
- .
- .
- .
NHibernate
- .
- , , XML — .
- , .
Writing unit tests frameworks
Unit tests allow you to quickly and automatically test individual components of an application independently of the rest of the application. Unit tests may not always cover the entire application code, but nevertheless they can significantly reduce the number of errors already at the development stage.
Popular frameworks:
- xUnit.net
- MS Test
- NUnit
I will consider xUnit
Tests in xUnit are defined as methods to which the Fact, Theory attributes are applied.
Fact is a separate test that has no parameters. Theory - a test that accepts parameters can have several scenarios.
Example
[Fact]
public void Should_do_somthing(){...}
[Theory]
[InlineData(20, 180, 80, ”good”)]
[InlineData(20, 180, 50, ”bad”)]
public void Should_measure_weight(int age, int height, decimal weight, string expected){...}
There is a whole paradigm of testing that xUnit fully implements: Arrange-Act-Assert.
- Arrange: sets the initial conditions for test execution
- Act: executes a test (usually represents one line of code)
- Assert: verifies the test result
Arrange and Act are regular C # code, while Assert is a separate class with a set of static methods to check the results.
Basic methods
- All(collection, action): , collection action
- Contains(expectedSubString, actualString): , actualString expectedSubString
- DoesNotContain(expectedSubString, actualString): , actualString expectedSubString
- DoesNotMatch(expectedRegexPattern, actualString): , actualString expectedRegexPattern
- Matches(expectedRegexPattern, actualString): , actualString expectedRegexPattern
- Equal(expected, result): result expected
- NotEqual(expected, result): result expected
- Empty(collection): , collection
- NotEmpty(collection): , collection
- True(result): , true
- False(result): , false
- IsType(expected, result): , expected
- IsNotType(expected, result): , expected
- IsNull(result): , null
- IsNotNull(result): , null
- InRange(result, low, high): , low high
- NotInRange(result, low, high): , low high
- Same(expected, actual): , expected actual
- NotSame(expected, actual): , expected actual
- Throws(exception, expression): , expression exception
Thus, we have passed 2 of the 7 points of the summary.
In the next part:
- DI frameworks
- Application designs understanding (n-Tier, Onion).
Thanks for reading, so I understand that I'm not the only one preparing for something;)
Materials: one , two , three