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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace FactoryMethodDesign.AbstractClass | |
{ | |
/// <summary> | |
/// Soyutlanacak base class abstract kelimesi ile belirtilir | |
/// </summary> | |
abstract class ArabaMarkasi |
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
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace Singleton | |
{ | |
public class SingleClass | |
{ | |
private SingleClass() | |
{ |
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
<html> | |
<head> | |
<title>Asp.Net Core ile Web Sockets Kullanımı</title> | |
</head> | |
<body> | |
<button id="btnConnect" type="submit">Connect</button><br /> | |
Message : <input id="lblMessage" style="width:300;" /><br /> | |
<button id="btnSendMessage" type="submit">Send Message</button><br /> | |
<button id="btnDisconnect" type="submit">Disconnect</button><br /> | |
<script> |
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
namespace WebSocketKullanimi | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
// CreateWebHostBuilder(args).Build().Run(); | |
BuildWebHost(args).Run(); | |
} |
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
[TestMethod] | |
public void Update_User_Than_Check_It_Is_Updated_Test() | |
{ | |
var actual = new User { Id = 2, FirstName = "User2_Updated", LastName = "User2LastName_Updated" }; | |
this.MockUserRepository.Update(actual); | |
var expected = this.MockUserRepository.GetById(actual.Id); | |
Assert.IsNotNull(expected); | |
Assert.AreEqual(actual.FirstName, expected.FirstName); | |
Assert.AreEqual(actual.LastName, expected.LastName); | |
} |
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
[TestMethod] | |
[ExpectedException(typeof(InvalidOperationException))]//Eğer beklediğimiz bir exception var ise bu şekilde tanımlayabiliriz | |
public void GetyId_With_Undefined_Id_Than_Exception_Occurred_Test() | |
{ | |
var expected = this.MockUserRepository.GetById(It.IsAny<int>()); | |
} |
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
[TestMethod] | |
public void Insert_User_Than_Check_GetAll_Count_Test() | |
{ | |
var actual = this.MockUserRepository.GetAll().Count + 1; | |
var user = new User { Id = 4, FirstName = "User4", LastName = "User4LastName" }; | |
this.MockUserRepository.Insert(user); | |
var expected = this.MockUserRepository.GetAll().Count; | |
Assert.AreEqual(actual, expected); | |
} |
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
[TestMethod] | |
public void GetById_Than_Check_Correct_Object_Test() | |
{ | |
var actual = new User { Id = 2, FirstName = "User2", LastName = "User2LastName" }; | |
var expected = this.MockUserRepository.GetById(2); | |
Assert.IsNotNull(expected); // Test is not null | |
Assert.IsInstanceOfType(expected, typeof(User)); // Test type | |
Assert.AreEqual(actual.Id, expected.Id); // test correct object found | |
} |
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
[TestMethod] | |
public void GetAll_Than_Check_Count_Test() | |
{ | |
var expected = this.MockUserRepository.GetAll().Count; | |
Assert.IsNotNull(expected); // test not null | |
Assert.IsTrue(expected > 0);// test GetAll returns user objects | |
} |
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
namespace UserRepositoryTest | |
{ | |
[TestClass] | |
public class UserRepositoryTest | |
{ | |
public readonly IUserRepository MockUserRepository; | |
public UserRepositoryTest() | |
{ | |
// Test metotları genelinde kullanacağımız User listesi |