This file contains 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 UserEMailNotificationSender.BL; | |
using UserEMailNotificationSender.Model; | |
namespace UserEMailNotificationSender | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
User aUser = new User("TheUser", "the_user@mail_service.com", false); |
This file contains 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 UserEMailNotificationSender.Infrastucture; | |
using UserEMailNotificationSender.Model; | |
namespace UserEMailNotificationSender.BL | |
{ | |
class SMTPNotificationSender | |
{ | |
SMTPClient smtpClient = new SMTPClient(); | |
public void sendNotificationForUser(User userToNotify) |
This file contains 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 Core.Interfaces; | |
using Core.Model; | |
namespace Core.Services | |
{ | |
public class NotificationService | |
{ | |
SendMail sendMail; | |
public NotificationService(SendMail _sendMail) |
This file contains 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 Core.Interfaces | |
{ | |
public interface SendMail | |
{ | |
void sendMail(string recipient, string subject, string message); | |
} | |
} |
This file contains 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 Core.Model; | |
using Core.Services; | |
using Infrastucture.Services; | |
using System; | |
namespace UserEMailNotificationSender | |
{ | |
public class Program | |
{ | |
static void Main(string[] args) |
This file contains 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 isNonPremiumUserMailSentAndValid() | |
{ | |
var user = new User("A", "A@B.com", false); | |
var expectedSubject = "Notification"; | |
var expectedMessage = "Dear A this is a Notification!"; | |
var sendMail = Mock.Create<SendMail>(); | |
new NotificationService(sendMail).sendNotificationForUser(user); |
This file contains 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
interface SensorDevice | |
{ | |
void powerOff(); | |
void enable(); | |
void disable(); | |
bool isEnabled(); | |
DateTime isEnabledSince(); | |
int getFirmwareVersion(); | |
long getSystemUptime(); | |
int getLastReading(); |
This file contains 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 SensorDevices | |
{ | |
public interface SensorDevice : DeviceControl, DeviceState, SensorReading | |
{} | |
public interface DeviceControl | |
{ | |
void powerOff(); | |
int getFirmwareVersion(); | |
long getSystemUptime(); |
This file contains 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 SensorDevices; | |
using FakeSensors; | |
using System; | |
namespace Console_SensorDevice_Test | |
{ | |
static class Program | |
{ | |
static void Main() | |
{ |
This file contains 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
private async void DoWhoisLookup() | |
{ | |
EnableInput(false); | |
try | |
{ | |
var googleWhoisLookup = new WhoisLookup(tbHostToLookup.Text); | |
// initiate HTTP request asynchronously | |
Task<string> getWhoisInfoTask = googleWhoisLookup.GetWhoisInformationsAsync(); |
OlderNewer