-
Notifications
You must be signed in to change notification settings - Fork 24
Задание с классами с тестами #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
markkket
wants to merge
6
commits into
ISUCT:Hanaeva_Valerija_Nikolaevna
Choose a base branch
from
markkket:master
base: Hanaeva_Valerija_Nikolaevna
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7d24737
1 classes sample
jskonst 6e6e4d9
Merge pull request #1 from ISUCT/jskonst
jskonst fc7b16b
check workflow
jskonst aaec038
Merge branch 'master' of https://github.com/ISUCT/Tprogramming_2022
jskonst efd44ce
Add files via upload
markkket 23d3a1d
Add files via upload
markkket File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| namespace CourseApp.Tests | ||
| { | ||
| using Xunit; | ||
|
|
||
| public class DocumentTest | ||
| { | ||
| [Fact] | ||
| public void OfficialTest() | ||
| { | ||
| var officDoc = new Official("Official memo �12", "Official memo", 451); | ||
| Assert.Equal("Official memo �12", officDoc.Name); | ||
| Assert.Equal("Official memo", officDoc.Type); | ||
| Assert.Equal(451, officDoc.Size); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ProtocolTest() | ||
| { | ||
| var protDoc = new Protocol("Protocol �22122", "Protocol", 366); | ||
| Assert.Equal("Protocol �22122", protDoc.Name); | ||
| Assert.Equal("Protocol", protDoc.Type); | ||
| Assert.Equal(366, protDoc.Size); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AnalyticalTest() | ||
| { | ||
| var anDoc = new Analytical("Special conclusion", "�onclusion", 215); | ||
| Assert.Equal("Special conclusion", anDoc.Name); | ||
| Assert.Equal("�onclusion", anDoc.Type); | ||
| Assert.Equal(215, anDoc.Size); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void OfficialDocumentSizeTest() | ||
| { | ||
| var officDoc = new Official("Official memo �12", "Official memo", 451); | ||
| var result = officDoc.DocumentSize(); | ||
| Assert.Equal("451 �� ", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ProtocolDocumentSizeTest() | ||
| { | ||
| var protDoc = new Protocol("Protocol �22122", "Protocol", 366); | ||
| var result = protDoc.DocumentSize(); | ||
| Assert.Equal("366 �� ", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AnalyticalDocumentSizeTest() | ||
| { | ||
| var anDoc = new Analytical("Special conclusion", "�onclusion", 215); | ||
| var result = anDoc.DocumentSize(); | ||
| Assert.Equal("215 �� ", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void OfficialWayTest() | ||
| { | ||
| var officDoc = new Official("Official memo �12", "Official memo", 451); | ||
| var result = officDoc.Way(); | ||
| Assert.Equal("C:/files", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ProtocolWayTest() | ||
| { | ||
| var protDoc = new Protocol("Protocol �22122", "Protocol", 366); | ||
| var result = protDoc.Way(); | ||
| Assert.Equal("D:/files/documents", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AnalyticalWayTest() | ||
| { | ||
| var anDoc = new Analytical("Special conclusion", "�onclusion", 215); | ||
| var result = anDoc.Way(); | ||
| Assert.Equal("C:/work/documents", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void OfficialNameOfElTest() | ||
| { | ||
| var officDoc = new Official("Official memo �12", "Official memo", 451); | ||
| var result = officDoc.NameOfEl(); | ||
| Assert.Equal("OfficialDocument: ", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ProtocolNameOfElTest() | ||
| { | ||
| var protDoc = new Protocol("Protocol �22122", "Protocol", 366); | ||
| var result = protDoc.NameOfEl(); | ||
| Assert.Equal("ProtocolDocument: ", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AnalyticalNameOfElTest() | ||
| { | ||
| var anDoc = new Analytical("Special conclusion", "�onclusion", 215); | ||
| var result = anDoc.NameOfEl(); | ||
| Assert.Equal("AnalyticalDocument: ", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void OfficialToStringTest() | ||
| { | ||
| var officDoc = new Official("Official memo �12", "Official memo", 451); | ||
| var result = officDoc.ToString(); | ||
| Assert.Equal("Official memo �12; 451 ��; Official memo", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void ProtocolToStringTest() | ||
| { | ||
| var protDoc = new Protocol("Protocol �22122", "Protocol", 366); | ||
| var result = protDoc.ToString(); | ||
| Assert.Equal("Protocol �22122; 366 ��; Protocol", result); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void AnalyticalToStringTest() | ||
| { | ||
| var anDoc = new Analytical("Special conclusion", "�onclusion", 215); | ||
| var result = anDoc.ToString(); | ||
| Assert.Equal("Special conclusion; 215 ��; �onclusion", result); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| namespace CourseApp; | ||
|
|
||
| using System; | ||
|
|
||
| public class Analytical : Document | ||
| { | ||
| public Analytical(string name, string type, double size) | ||
| : base(name, type, size) | ||
| { | ||
| } | ||
|
|
||
| public override string DocumentSize() | ||
| { | ||
| return $"{Size} Мб "; | ||
| } | ||
|
|
||
| public override string Way() | ||
| { | ||
| return "C:/work/documents"; | ||
| } | ||
|
|
||
| public override string NameOfEl() | ||
| { | ||
| return "AnalyticalDocument: "; | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return $"{Name}; {Size} Мб; {Type}"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| namespace CourseApp; | ||
|
|
||
| using System; | ||
|
|
||
| public abstract class Document | ||
| { | ||
| public Document(string name, string type, double size) | ||
| { | ||
| this.Name = name; | ||
| this.Type = type; | ||
| this.Size = size; | ||
| } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public string Type { get; set; } | ||
|
|
||
| public double Size { get; set; } | ||
|
|
||
| public void Print() | ||
| { | ||
| Console.Write($"Название документа: {Name} Тип документа: {Type} Размер документа: {Size} Мб"); | ||
| } | ||
|
|
||
| public virtual string DocumentSize() | ||
| { | ||
| return "200 Мб"; | ||
| } | ||
|
|
||
| public virtual string Way() | ||
| { | ||
| return "sss"; | ||
| } | ||
|
|
||
| public virtual string NameOfEl() | ||
| { | ||
| return "3"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| namespace CourseApp | ||
| { | ||
| using System; | ||
|
|
||
| public class Phone | ||
| { | ||
| private float diaonal; | ||
|
|
||
| public Phone(string name, float diagonal) | ||
| { | ||
| Name = name; | ||
| Diagonal = diagonal; | ||
| } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public float Diagonal | ||
| { | ||
| get | ||
| { | ||
| return diaonal; | ||
| } | ||
|
|
||
| set | ||
| { | ||
| if (value > 0 && value < 20) | ||
| { | ||
| this.diaonal = value; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public void Show() | ||
| { | ||
| Console.WriteLine($"{Name} with diagonal {diaonal}"); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| namespace CourseApp; | ||
|
|
||
| using System; | ||
|
|
||
| public class Protocol : Document | ||
| { | ||
| public Protocol(string name, string type, double size) | ||
| : base(name, type, size) | ||
| { | ||
| } | ||
|
|
||
| public override string DocumentSize() | ||
| { | ||
| return $"{Size} Мб "; | ||
| } | ||
|
|
||
| public override string Way() | ||
| { | ||
| return "D:/files/documents"; | ||
| } | ||
|
|
||
| public override string NameOfEl() | ||
| { | ||
| return "ProtocolDocument: "; | ||
| } | ||
|
|
||
| public override string ToString() | ||
| { | ||
| return $"{Name}; {Size} Мб; {Type}"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а что за каракули? а этот MR еще нужен? можем его закрыть?