You guys, I am so excited for today's post. Over the last few months I've been getting so many questions about photography and lenses and how I take photos of my kid. Turns out there are SO many moms out there that desperately want to take better photos of their little ones, but just don't have a lot of "photography knowledge" to move their photos from average to awesome. Yeah, I'm talking about YOU, mama. Most of you already have a nice camera (DSLR), but have either been taking photos on Auto (that green square) or inside with bad lighting using the flash (NO!). If you're doing either of these things, it's no wonder your photos aren't turning out lovely as you'd like them to. And if you're not but still want to improve your pictures, you've come to the right place and are already ahead of the game.
So, I've decided to start a series of posts called "Photography for Moms" - all about how regular moms with regular cameras can start taking better photos of their kids without overwhelming you with technical gobbledygook or taking up a bunch of your time. I am planning to have guest posts from real moms that take beautiful photos of their kids and can give you easy ways to improve your photos without having to invest a lot of time, effort or money into photography. This is less about professional photographers telling you how they do it (with fancy gear, exact settings in full manual and editing) and more about real-life moms telling you what they do (with the camera they have) to get great pictures. And I don't mean dumbing things down for you (because I already know that if you're reading this blog, you're brilliant), but making the information relatable and giving you practical advice that you can use right away.
Today, I'm thrilled to introduce you to one of my real life best friends, attorney/scientist/blogger/photographer/mama extraordinaire, Jessica. You guys might remember her for taking the photos from THIS post of me and Mac. Those pictures of some of my all time favorites. Jessica is a mom who fell hard for photography when her daughter Julia was born. I've had the pleasure of learning right along with her and watching her photos go from good to great. She's now got two gorgeous daughters to be her models and I just love seeing her pictures of them. She's hoping to someday "go pro" with her photography, but for now she's focusing on growing her portfolio and her skills, both of which she blogs about HERE. I love her posts because she's so honest and not afraid to talk about how nervous she is taking photos for other people, how her practice shoots go and when/why something didn't work. Also, she's so kindly volunteered to take some maternity/belly shots of me in the upcoming months, so stay tuned for those!
Her post today is awesome and one of those posts that gets right down to the absolute basics of photography without getting technical at all! You could be using your iPhone to take photos and this tutorial will drastically improve your photos, guaranteed. No fancy equipment or complicated settings necessary. It focuses taking photos indoors with natural light and how to make it work best for you. Jessica does a great job at giving really great descriptions of what works and doesn't work and how to make bad situations better. If you guys are still stuck inside (like me) due to freezing temperatures and snow, this posts gives you something to do! Practice with these settings, play around with the light, try it out. Seriously, read this tutorial then go grab your kid, give them a book/iPad/doll, stick them by a window and take some photos of them. You're going to be blown away at how much better your pictures look. So, without further ado, here is Jessica!
I'm so honored to be posting on Sara's blog today!
I used to be an attorney, which is how I met Sara - we were at the same firm way back in the day. I was on my way out when I got pregnant with my first, and I've been a stay at home mom since. Now I have two girls, Julia (3) and Lana (21 months), and I'm hoping to go professional with my photography someday. I got my first DSLR when Julia was a few months old, loved it, and then gave birth to a terrible napper, so I spent large chunks of my day taking pictures of my children to keep from going mad. I was so flattered when Sara asked me to put together a photography tutorial. I can be my own worst critic, but after five child-years of badgering my girls with my camera, I've seen a major improvement in my photos. I'm still learning, every day and with every set of photos I take, but the more I take the more I notice. I'm hopeful that some will find this helpful. I'm also blogging over at http://jessicaglunt.zenfolio.com/ about my "adventures" in trying to get a photography business up and running. I hope you'll stop by.
When Sara first approached me, I knew immediately that I wanted to discuss indoor portraits. It's winter and we're all stuck inside a lot, but that doesn't mean we want to shelve the camera until spring. While I focus mainly on babies and children, the same principles apply to adults (and pets!). Most moms don't carry around extra flashes, and most rooms have one main window, so I'm going to talk about taking pictures of your child using natural light from a single window. Southern facing windows tend to get the most sun, especially in the winter (and is what you'll see in these photos), but you work with what you have; in our last house, a large western facing window ended up giving me the best light in the afternoon.
Photography tutorials inevitably talk about light; I've read, "Pay attention to the light!" ten thousand times. But when I was starting out, I'd wonder what exactly that meant. I was always chasing a child and never felt like I had a chance to experiment with this "light" of which they spoke. So today, I'm going break it down. A lot. I'm wordy. I apologize.
Also, all opinions here are my own. You decide what you like best, for yourself. Everyone has different tastes, opinions, and different constraints when they're taking pictures. These are merely my thoughts and if yours are different, that's okay!
These were taken in my daughter's bedroom because her room was passably neat and for the single, Southern-facing window. When I took these photos, the window was the only source of light. It was midday, so the sun was pretty harsh. I used a Nikon D800, 50mm lens, ISO 200, f/2, and 1/200, unless otherwise noted, with Auto White Balance. Exposure will differ throughout these photos because I tried to keep my settings the same as much as possible so you can see the differences in light. My subject is Baby, for her unique ability to sit still for longer than 2.3 seconds.
See how most of the room is properly exposed, but the areas in direct sunlight are completely white (blown out)? With the sun so bright, your camera's sensor isn't able to capture the scene's entire range from dark to direct light. You can use this for effect, but it's not ideal for portraits.
When your child is in bright light like this, you can expose for the background, or the subject, but not both. If you were outside, the entire scene would be as bright as the baby, and you wouldn't have this problem. But, you won't typically find that scenario indoors. So… Light is good, more light is better, but direct light is difficult. I threw a dark towel over a bookcase for a background and took Baby out of the direct light - just a few feet over.
The window is behind me and over my right shoulder. Notice the shadows on Baby's face: her chin, bottom lip, and under her nose are all defined, along with a slight curve of her forehead, courtesy of the light being higher than her face. The right side of her face is in shadow, which is a little undesirable, but the shadow on the right side of her nose (Baby's right) helps give her face some dimension. Light straight on can flatten a face: some shadow helps define a person's features, but too much can be distracting - most of my photography struggles with finding the middle ground between those two. Also notice the lights reflected in Baby's eyes - catchlights - which are typically thought of as positives, helping the eyes look alive. Your subject's eyes will reflect the light source; you can see the window light and the splash of light on the floor. Honestly, I don't usually worry too much about capturing catchlights when I'm shooting, but it can help you dissect your photos later on, and an awareness of them could influence how you position your subject.
An aside - be aware of your own shadow. When the room is bright, it can be easy to miss it if you're moving a lot and come between your subject and the light. Here, I didn't change settings, but I moved so I cast a shadow on Baby. It's not necessarily going to ruin your photo, but it's definitely something to keep an eye on. You don't want to suddenly underexpose, and you really don't want the outline of your head across someone's face.
Now, I threw a white towel behind Baby. I didn't change anything else.
And here she is, just a little further away.
See what a difference that makes? Anyways, back to Baby. I put the dark background back and spun the setup ninety degrees to the right. The window is now to Baby's left.
Her whole face is a little darker now because the light isn't hitting her straight on anymore; the exposure is easily fixed either by adjusting your settings while shooting (which I did not), or later in post-processing - this happens all the time with fast-moving kids. See how there aren't any catchlights because she's facing 90 degrees from the light source? Also see how the shadows are also more defined? When the light is more off to the side, or more one-directional, you're going to get patches of light on your child's face, like on Baby's nose, upper lip, cheekbone, and forehead. This would not be my preferred lighting. The wall to Baby's right was already white, so adding a reflector did very little to brighten up the right side of her face. Now I spun Baby to face the light more.
It's still a little darker than I would prefer but I really like the way the light hits her here. (I always err on the side of overexposing when I photograph people; it seems to smooth out skin and be more flattering overall.) The variation of light and shadow across her face really defines her features, yet isn't so great that part of her looks unpleasantly dark. The tough part about taking photos at this angle is the focus. You should always aim for the nearest eye, but the back eye often will be slightly out of focus. It's not a problem, really, but sometimes you just want the whole face to be in focus, and shooting at this angle can make that difficult. Here is Baby with her back to the window, with some light reflecting onto her from the floor, to her right. Again, it's too dark, but it's fairly even and her face is well-defined.
I spun her 90 degrees again, so here the window is to her right. The lower half of the walls in this room are white, so I figured they were acting as reflectors and evening out some shadows without me really noticing.
So I put another dark towel off to Baby's left, which would simulate the light-absorbing properties of darker walls, furniture, or even just empty space. Then I switched it out for a white towel.
It's a big difference. Reflecting the window light, even using something as simple as a white towel, went a long way towards softening the shadows on Baby's face. You can use anything white - a wall, poster board, sheet, or a reflector designed for this very purpose. (I do own one but I wanted to show you that even a common object can really make a difference. Also mine was in the car and it was really cold outside.) If you use something light but colored, it will reflect that color.
Put them in a well-lit room, keep them out of direct sunlight, and try to position them so the light hits them at a slight angle. Even if you don't see it when you're shooting, imagine the light coming into the room like a straight line from the window, and try getting your child to face generally in the direction of the light but somewhere between parallel and perpendicular to it. (I struggle with actually noticing the light well during a session, so I go about photo sessions more analytically than intuitively.) Use anything white to bounce some light onto the shadowed side of their face if you can. Another strategy is to line up: the window, something to block the light, your child (facing away from the window), and then your camera. It'll be darker but the light will be even. A quick note on babies, particularly those who aren't yet sitting well. Here are a few pictures of Baby on the floor, spun around so the light is coming from different directions. Here's the general set-up.
The window is at her feet. This is awkward. The shadows on Baby's face fall right under her eyes, and along with the shadows falling in a general "up" direction instead of "down" is unnatural to our eyes. Side shadow is nicer….
But adding a reflecting surface to Baby's right is even nicer.
Here is Baby's head towards the window, with a reflector on the darker side of her face. This also looks nice. Reflectors are fairly easy to use with a baby since you're not chasing a mobile human, so take advantage of them to even out the light if you can. Switching gears a little… So far this has been about "classically" well-lit portraits. You can also have a lot of fun with bright window lighting.
You can accept that part of the room will be too dark, but expose for your child's face. A child with actual hair, and not a bald baby doll, would have a pretty halo of bright hair around his or her face in a photo like this.
Notice how Baby's face is actually pretty evenly lit since her back is to the sun? You can also expose for your child and let the light in the background blow out to white. I couldn't get a good picture of this with Baby, but here's an example I took earlier with Lana. I was shooting through a doorway into a bright room (ok a bathroom).
You can expose for the outdoors and throw your child mostly into shadow. Exposing for the outdoors can be a beautiful way to shoot straight in to the sun and capture your child's silhouette. It's not great here since the view out this window isn't much to talk about, but in general I love the sense of mystery and peacefulness that comes from a silhouette portrait.
You can put your child in that patch of sun and let the background go dramatically dark.
A sheer window treatment can really be beautiful to help diffuse bright sunlight so the light to dark variation within your image isn't so great, but it can also give you a blown-out white section where the window is, if that's a look you like. I really like it sometimes. Here's an example with bright sunlight coming in through sheer drapes.
I generally do not turn on interior lights when I'm taking pictures indoors. The color of light bulbs is almost always different from the color of natural light, and even if it looks similar at one point, the color of natural light varies dramatically during the day. When you have light sources with different temperatures/color tints, it's virtually impossible to get your white balance right, making your kids' skin color look really strange. When it just can't be avoided, I have to take my images to black and white in post-processing to save them. Below is an example. The sun was setting so the natural light was very cool, and the room was dark enough that I needed to turn on the overhead lights and a lamp to make a picture possible at all. Now, there may be people better at Photoshop than I, but no amount of fiddling with white balance could eliminate the tint on the girls.
And with that, my brain is empty. If you've stuck with me this far, thank you! I hope some of this was helpful or gave you some ideas. Indoor photos can be really tough, so really the most important thing is to not get discouraged. You're capturing your family's lives, and the photos will be precious to you regardless of how "technically good" they are.
Huge thanks to Sara for the guest post!
Thank you Jessica for this awesome post! I hope you guys got some good advice and tips out of this. I'd love to get your feedback on this post and the series. In addition, Jessica has kindly offered to answer any questions you might have about the post, her settings or photography in general. You can also find her on Facebook at Emma Constance Photography. Now go get your camera out and play!
Thank you for doing this series! I have an 18 month old boy and live in CT, so we are inside most of the weekends right now, its driving me crazy that I have no good pictures of him this winter (cant wait for the spring to be outside!!). I am going to practice so much with these tutorials and hopefully get a few good pics. So thank you! Also, what is your favorite lens? I mostly use the kit lens, which I know I shouldnt do, and i have the 50mm 1.8, but I dont really use that inside. Which lens would you recommend that is better than the kit lens, but not crazy expensive? I have a canon dslr. Thanks!!
I think the 50mm is actually a great choice of lens. The wider the angle (the lower the #mm), the easier it is to use indoors with space constraints, but the more distortion you get around the edges of your image. The 50mm is often a favorite all-purpose lens because it hits a sweet spot between ease of use and distortion. With 1.8 max aperture, it should be plenty fast and about as good as it gets in low light. Give your 50mm another shot!
There's nothing wrong with the kit lens, if that's what you like to use. It's versatile, and if you're comfortable with it, that goes a long way. Keep using that and see what zoom you end up using a lot. Do you keep wanting to zoom out more? I love my 85mm prime for portraits, but it's difficult to use indoors because I have to be pretty much across the room to get a good shot. I have a 35mm too, which I like for indoors but I usually find myself reaching for the kit zoom lens instead for the versatility, since 35mm falls in its range. But again, the 50mm is a great prime lens, and not just for people starting out - lots of pros love it. I'd tell you to try that again before dropping money on another lens.
I agree with all of this--there's nothing wrong with the kit lens! There's actually a great Flickr group called "Kit Lens Losers" that I *highly* recommend checking out. Kit lenses do have a bad reputation, but for the most part, I honestly think it is unfounded. The 50mm 1.8 is also a great lens and what I use almost exclusively for portraits.
I would actually recommend not buying another lens right now--I bet that by learning just a bit about how to get out of auto mode, you'll be really happy with what you already have!
Thank you so much! I will be practicing with what I read today and getting more used to non auto on the camera :) It intimidates me becuase I'll get like one good picture out of 300 that I take when in AV mode.
Mel, that is totally normal! Keep at it. Try setting up one shot at a time, deliberately, rather than trying to take a billion and hoping one or two are good. It's harder, and your photos will get worse before they get better, but it'll help your success rate in the end. That said, you're in a totally normal spot. People only post their good pictures, so it's easy to get a warped view of what everyone else is doing!
I'm SO excited about this series! I have this big fancy camera and my pictures still look like crap. I need these lessons for sure! Can't wait to try these techniques!
GREAT post! I shoot in M with the baby since she's not really mobile other than kicks so it's easier to fiddle with, with A I shot in Av since I can't change the settings to keep up with her (yet!). I'm really looking forward to learning a bit more with this series!
WOW!! Such great info I've never thought of before - thank you! So excited for this series!
Not at all related to your post -- but in regards to your comment -- IF we somehow have a name before she comes, we'll probably share. Although we are awful at names and no where close. Even with Reese we were down to two and really up until probably a handful of days before she arrived she was going to be an Addison and we switched last minute. So I do have some fear of the switch happening after we share. But current names on the ever growing (not shrinking name) include Alyson, Campbell, Morgan, Emerson, Reagan, Hadley, and Claire. Good luck figuring out a name for your sweet baby girl!
This is so great! Winter indoor shots are so hard! I haven't totally made sense of all these tips but I'm saving this post because it's got so much details in it! Thank you! Stopping by to check out your blog too Jessica!
Thank you so much for the post, Jessica! Can't wait to try out a reflector.
My pleasure! The difference they make can be subtle but also make all the difference in the world in your photos. Good luck!
This is such great advice! I'm not a mom but when I take pictures inside w/ my dslr it's soo hard to make them look good with the limited lighting!
Yay, I love all of your photography tutorials. Thanks Jessica for such an easy to understand step by step guide. I will definitely make use of this.
This was beyond helpful! I'm anxious to get my camera out & get snapping! Thanks so much!
Wow! This is so helpful! I'm always struggling with lighting and shadowing, especially when I'm outside or near windows! I'm looking forward to the rest of this series!
What do you mean by "exposing for the outdoors" or "exposing for the skin"?...that has always confused me!
Good question! So, proper exposure means that the light in your photo ranges from dark to light, but without any of the photo being so dark that it's just black, and without any of your photo being so light that it's just pure white. Your camera can only capture so much range from dark to light - that's just a limitation of a camera's sensor - so the goal of a properly exposed photo is to get the settings such that the picture falls within that range.
For digital cameras, it might be helpful to think about pixels - you want all of the pixels to contain some light (so, none totally black), but not so much light that they're completely white.
You can also think of proper exposure as what's pleasing to the eye. Underexposed photos just look too dark, and overexposed photos just look too white.
When there's a large variation from dark to light in a scene, you have to pick where you want your range to fall. So, "exposing for the skin" means that you get a person's skin to look good - not too dark or too light - and let the rest of the scene fall where it may.
Your camera has a metering system, where it measures the light in a scene, and that helps it determine the settings when it's on Auto mode. In manual mode, it will show you a little graphic with bars to help you determine what settings will give you proper exposure. There are several different metering settings and modes, different by camera and manufacturer, so you'll have to dig out your camera's manual if you want to delve into that a little deeper.
I usually use center spot metering, and so I tell my camera to evaluate the light at one spot (which I put over my subject), and then adjust my settings from there to manually set my exposure. You can also just play with your settings and check your screen after each picture to see what works.
Does that answer your question? I found exposure talk really confusing when I was first starting out. Everyone was talking about it as if everyone else totally understood it, and I just wanted someone to explain proper exposure to me in the first place. Feel free to ask more!
Thank you so much Jessica!! This is actually the best and most understandable description that I've ever gotten about the subject. I'm going to need to play around with it more to understand it even better- but this has been so helpful! My current photography goal is to be able to get the picture as correct as possible in-camera so that I can cut down on the amount of post-processing that happens after the fact....and that all starts with learning your camera as much as possible. Thanks again!
Start with histograms. There are a bunch of good articles out there, easily found via Google, on how to access the histogram for your photos and how to interpret them. It takes some practice to understand it intuitively, but it'll help you a lot as you look into metering. And it helps with post-processing too - you can't recover data in black or white pixels, so there's a limit to what PP can do to fix a photo that's been over- or under-exposed. Understanding a histogram will help you understand instantly whether you need to change your settings to produce a salvageable photo.
Very much looking forward to this series...thank you! Very helpful!
I love this series! SO HELPFUL since I have NO idea what I'm doing when I'm taking pictures! I just snap away and then chose the one I like the best lol.
Such great tips here!! Now if I can only get my toddler to sit still long enough for some practice. Got any tips for that? ;-) Looking forward to the rest of the series!
Thanks for sharing all of this!! I try to use M as often as possible! The pictures taken in Auto are almost not with taking if I want to frame / share them. The light in our house isn't great in most areas... I have only a few chosen spots with great natural light :( Looking forward to learning more!
Very interesting post! I'm so excited you are starting this series!


The latest airport to be released by Aerosoft is Airport Bergamo XP for X-Plane 11.
Known as Milan/Bergamo, it is one of three international airports in the Milan region. Besides being a hub for Ryanair and offering seasonal and charter flights, Bergamo Airport is also an important cargo hub – both UPS and DHL have a large presence here, connecting northern Italy to major destinations in Europe.
Airport Bergamo from Aerosoft is an up-to-date recreation of this airport complete with all service facilities and buildings, both for the airport and the surrounding area. It comes with an aerial image used for this scenery comes with a resolution of 50cm/pixel and hand-placed autogen. Other highlights include animated jetways, windsocks and ground traffic.
Airport Bergamo XP is available over on the Aerosoft website for €24.15 (£21/$27 approx). Click here for more information. Click here for more information.


text:
Organization (Peter Doggers)
Harry Gielen
Ab Scheel
Live games Univé Matches
Live Open group
Anish Giri - Alexei Shirov
Jan Timman - Baadur Jobava
Games / PGN
Photo: Peter Doggers
Peter Boel
Tex de Wit, a comedian and a chess commentator, presented the closing ceremony smoothly. His first 'guest' was alderman Gert Vos of Hoogeveen, who had been impressed throughout the week by the 'noble spirit' of chess: 'I've played soccer and volleyball, but there's always noise there. A chess tournament has a respectful, concentrated atmosphere.'
He called it a great honour to host this chess event in the Hoogeveen town hall, and said that, as far as he knew, the tournament would be welcome again next year. Then he asked for a round of applause for the tournament secretary, the very versatile Jeroen Bottema, and for the new tournament director Loek van Wely, who had done a great job in his opinion: 'I've seen nothing but satisfied faces here.'
Gert Vos | Photo: Peter Doggers
The tournament treasurer, Teun Boersma, addressed Loek van Wely especially: 'You've made something very special of this event, and I am convinced that you will become a good "horseman".' Then he presented the ruling Dutch champion with a beautiful book called 'The Beauty of the Horse'.
To the question repeated by Tex de Wit, what was actually worse: losing a tournament or leading one, Van Wely still didn't give a clear-cut answer: 'I haven't really been myself this week… next week I'll be a player again, and chess gives me less stress for sure. Do I have more respect for organizers now? Well, I may have been nasty to some of them in the past… now I'll think again before I do that.' In any case many people have come to respect the leading capabilities of the top chess player from Tilburg.
Loek van Wely | Photo: Peter Doggers
The Prize Giving
Wouter Slump got a prize for the best performance in Nick Maatman's simultaneous display at McDonald's. In Amateur Group 2 (the morning group), Tinus Fleur was the champion. A few decades ago he'd had a winning position against Loek van Wely in the town of Gorredijk. Had he converted that position, who knows he might have been standing on the stage in another capacity today. The main prize in Amateur Group 1 (afternoon) went to Johan Mostertman.
Van Wely said that he thought the new set-up of the tournament, with two matches instead of a four-player double round robin, was a success: 'We had four great fighters. I was hoping for many decisions, and uncompromising play, and I am happy. Only Baadur Jobava let me down: he played a few "normal" games here. That wasn't the deal."
Jan Timman was of course disappointed with his result, but he said he had enjoyed playing such an interesting opponent. When Jobava was asked whether he was happy, he simply said: 'Yes!'
Jobava thanks Timman | Photo: Peter Doggers
De Wit, who is a fan of Shirov's Fire on Board books, asked the author if we could expect a third volume soon. 'Maybe', Shirov answered, still a little shaken. 'But then the title may be "Smoke after Fire..."
Like Baadur Jobava, Anish Giri was about to travel to Tashkent to play the Grand Prix tournament. 'Here things worked out well, let's see if they also work out well there. I may be one of the favourites now, but I still have the feeling that my rating is a bit too high.' We'll see in the coming days.
Anish Giri with his trophy | Photo: Peter Doggers
Finally Van Wely handed a prize to Mees van Osch, who had achieved his first IM-norm in the Open. And so there were many satisfied faces, Saturday night in Hoogeveen.
Many thanks to everyone involved in the tournament, and hopefully till next year!
« Giri and Jobava strike one more time
Round 6 »
Peter Boel is a FIDE master and Managing Editor with New In Chess. He is also a freelance journalist, a writer and a translator. For several years he was the press officer at the Dutch Chess Championships. At present he is the press officer at the Dutch Open and various other chess tournaments.
The Univé chess tournament is made possible by:

redpajama_set_name: RedPajamaCommonCrawl


text:
<#
    .SYNOPSIS
        Automated unit test for DSC_SqlEndpoint DSC resource.

#>

Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1')

if (-not (Test-BuildCategory -Type 'Unit'))
{
    return
}

$script:dscModuleName      = 'SqlServerDsc'
$script:dscResourceName    = 'DSC_SqlEndpoint'

function Invoke-TestSetup
{
    try
    {
        Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop'
    }
    catch [System.IO.FileNotFoundException]
    {
        throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.'
    }

    $script:testEnvironment = Initialize-TestEnvironment `
        -DSCModuleName $script:dscModuleName `
        -DSCResourceName $script:dscResourceName `
        -ResourceType 'Mof' `
        -TestType 'Unit'

    # Loading mocked classes
    Add-Type -Path (Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Stubs') -ChildPath 'SMO.cs')
}

function Invoke-TestCleanup
{
    Restore-TestEnvironment -TestEnvironment $script:testEnvironment
}

Invoke-TestSetup

try
{
    InModuleScope $script:dscResourceName {
        $mockServerName = 'localhost'
        $mockInstanceName = 'INSTANCE1'
        $mockPrincipal = 'COMPANY\SqlServiceAcct'
        $mockOtherPrincipal = 'COMPANY\OtherAcct'
        $mockEndpointName = 'DefaultEndpointMirror'
        $mockEndpointType = 'DatabaseMirroring'
        $mockEndpointListenerPort = 5022
        $mockEndpointListenerIpAddress = '0.0.0.0'  # 0.0.0.0 means listen on all IP addresses.
        $mockEndpointOwner = 'sa'

        $mockOtherEndpointName = 'UnknownEndpoint'
        $mockOtherEndpointType = 'UnknownType'
        $mockOtherEndpointListenerPort = 9001
        $mockOtherEndpointListenerIpAddress = '192.168.0.20'
        $mockOtherEndpointOwner = 'COMPANY\OtherAcct'

        $mockSsbrEndpointName = 'SSBR'
        $mockSsbrEndpointType = 'ServiceBroker'
        $mockSsbrEndpointListenerPort = 5023
        $mockSsbrEndpointListenerIpAddress = '192.168.0.20'
        $mockSsbrEndpointOwner = 'COMPANY\OtherAcct'
        $mockSsbrIsMessageForwardingEnabled = $true
        $mockSsbrMessageForwardingSize = 2
        $mockSsbrEndpointState = 'Started'

        $script:mockMethodAlterRan = $false
        $script:mockMethodCreateRan = $false
        $script:mockMethodDropRan = $false
        $script:mockMethodStartRan = $false

        $mockDynamicEndpointName = $mockEndpointName
        $mockDynamicEndpointType = $mockEndpointType
        $mockDynamicEndpointListenerPort = $mockEndpointListenerPort
        $mockDynamicEndpointListenerIpAddress = $mockEndpointListenerIpAddress
        $mockDynamicEndpointOwner = $mockEndpointOwner
        $mockDynamicIsMessageForwardingEnabled = $null
        $mockDynamicMessageForwardingSize = $null
        $mockDynamicEndpointState = 'Started'

        $mockEndpointObject = {
            # TypeName: Microsoft.SqlServer.Management.Smo.Endpoint
            return New-Object -TypeName Object |
                Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockDynamicEndpointName -PassThru |
                Add-Member -MemberType NoteProperty -Name 'EndpointType' -Value $mockDynamicEndpointType -PassThru |
                Add-Member -MemberType NoteProperty -Name 'EndpointState' -Value $mockDynamicEndpointState -PassThru |
                Add-Member -MemberType NoteProperty -Name 'ProtocolType' -Value $null -PassThru |
                Add-Member -MemberType NoteProperty -Name 'Owner' -Value $mockDynamicEndpointOwner -PassThru |
                Add-Member -MemberType ScriptProperty -Name 'Protocol' -Value {
                    return New-Object -TypeName Object |
                        Add-Member -MemberType ScriptProperty -Name 'Tcp' -Value {
                            return New-Object -TypeName Object |
                                Add-Member -MemberType NoteProperty -Name 'ListenerPort' -Value $mockDynamicEndpointListenerPort -PassThru |
                                Add-Member -MemberType NoteProperty -Name 'ListenerIPAddress' -Value $mockDynamicEndpointListenerIpAddress -PassThru -Force
                        } -PassThru -Force
                } -PassThru |
                Add-Member -MemberType ScriptProperty -Name 'Payload' -Value {
                    return New-Object -TypeName Object |
                        Add-Member -MemberType ScriptProperty -Name 'DatabaseMirroring' -Value {
                            return New-Object -TypeName Object |
                                Add-Member -MemberType NoteProperty -Name 'ServerMirroringRole' -Value $null -PassThru |
                                Add-Member -MemberType NoteProperty -Name 'EndpointEncryption' -Value $null -PassThru |
                                Add-Member -MemberType NoteProperty -Name 'EndpointEncryptionAlgorithm' -Value $null -PassThru -Force
                        } -PassThru -Force |
                        Add-Member -MemberType ScriptProperty -Name 'ServiceBroker' -Value {
                            return New-Object -TypeName Object |
                                Add-Member -MemberType NoteProperty -Name 'EndpointEncryption' -Value $null -PassThru |
                                Add-Member -MemberType NoteProperty -Name 'EndpointEncryptionAlgorithm' -Value $null -PassThru |
                                Add-Member -MemberType NoteProperty -Name 'IsMessageForwardingEnabled' -Value $mockDynamicIsMessageForwardingEnabled -PassThru |
                                Add-Member -MemberType NoteProperty -Name 'MessageForwardingSize' -Value $mockDynamicMessageForwardingSize -PassThru
                        } -PassThru -Force
                } -PassThru |
                Add-Member -MemberType ScriptMethod -Name 'Alter' -Value {
                    $script:mockMethodAlterRan = $true

                    if ( $this.Name -ne $mockExpectedNameWhenCallingMethod )
                    {
                        throw "Called mocked Alter() method on and endpoint with wrong name. Expected '{0}'. But was '{1}'." `
                                -f $mockExpectedNameWhenCallingMethod, $this.Name
                    }
                } -PassThru |
                Add-Member -MemberType ScriptMethod -Name 'Drop' -Value {
                    $script:mockMethodDropRan = $true

                    if ( $this.Name -ne $mockExpectedNameWhenCallingMethod )
                    {
                        throw "Called mocked Drop() method on and endpoint with wrong name. Expected '{0}'. But was '{1}'." `
                                -f $mockExpectedNameWhenCallingMethod, $this.Name
                    }
                } -PassThru |
                Add-Member -MemberType ScriptMethod -Name 'Start' -Value {
                    $script:mockMethodStartRan = $true
                } -PassThru |
                Add-Member -MemberType ScriptMethod -Name 'Stop' -Value {
                    $script:mockMethodStopRan = $true
                } -PassThru |
                Add-Member -MemberType ScriptMethod -Name 'Disable' -Value {
                    $script:mockMethodDisableRan = $true
                } -PassThru |
                Add-Member -MemberType ScriptMethod -Name 'Create' -Value {
                    $script:mockMethodCreateRan = $true

                    if ( $this.Name -ne $mockExpectedNameWhenCallingMethod )
                    {
                        throw "Called mocked Create() method on and endpoint with wrong name. Expected '{0}'. But was '{1}'." `
                                -f $mockExpectedNameWhenCallingMethod, $this.Name
                    }
                } -PassThru -Force
        }

        $mockConnectSql = {
            return New-Object -TypeName Object |
                Add-Member -MemberType ScriptProperty -Name Endpoints -Value {
                    return @(
                        @{
                            # This executes the script block $mockEndpointObject and returns a mocked Microsoft.SqlServer.Management.Smo.Endpoint
                            $mockDynamicEndpointName =  & $mockEndpointObject
                        }
                    )
                } -PassThru -Force
        }

        $mockNewObjectEndPoint = {
            # This executes the script block $mockEndpointObject and returns a mocked Microsoft.SqlServer.Management.Smo.Endpoint
            return & $mockEndpointObject
        }

        $mockNewObjectEndPoint_ParameterFilter = {
            $TypeName -eq 'Microsoft.SqlServer.Management.Smo.Endpoint'
        }

        $defaultParameters = @{
            InstanceName = $mockInstanceName
            ServerName   = $mockServerName
            EndpointName = $mockEndpointName
            EndpointType = $mockEndpointType
        }

        $defaultSsbrParameters = @{
            InstanceName = $mockInstanceName
            ServerName   = $mockServerName
            EndpointName = $mockSsbrEndpointName
            EndpointType = $mockSsbrEndpointType
        }

        Describe 'DSC_SqlEndpoint\Get-TargetResource' -Tag 'Get' {
            BeforeEach {
                $testParameters = $defaultParameters

                Mock -CommandName Connect-SQL -MockWith $mockConnectSql -Verifiable
                Mock -CommandName New-Object -MockWith $mockNewObjectEndPoint -ParameterFilter $mockNewObjectEndPoint_ParameterFilter -Verifiable
            }

            # Make sure the mock does not return the correct endpoint
            $mockDynamicEndpointName = $mockOtherEndpointName

            Context 'When the system is not in the desired state' {
                It 'Should return the desired state as absent' {
                    $result = Get-TargetResource @testParameters
                    $result.Ensure | Should -Be 'Absent'
                }

                It 'Should return the same values as passed as parameters' {
                    $result = Get-TargetResource @testParameters
                    $result.ServerName | Should -Be $testParameters.ServerName
                    $result.InstanceName | Should -Be $testParameters.InstanceName
                }

                It 'Should not return any values in the properties for the endpoint' {
                    $result = Get-TargetResource @testParameters
                    $result.EndpointName | Should -Be ''
                    $result.Port | Should -Be ''
                    $result.IpAddress | Should -Be ''
                    $result.Owner | Should -Be ''
                    $result.IsMessageForwardingEnabled | Should -Be $null
                    $result.MessageForwardingSize | Should -Be $null
                }

                It 'Should call the mock function Connect-SQL' {
                    Get-TargetResource @testParameters | Out-Null
                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }
            }

            # Make sure the mock do return the correct endpoint
            $mockDynamicEndpointName = $mockEndpointName

            Context 'When the system is in the desired state (mirror)' {
                It 'Should return the desired state as present' {
                    $result = Get-TargetResource @testParameters
                    $result.Ensure | Should -Be 'Present'
                }

                It 'Should return the same values as passed as parameters' {
                    $result = Get-TargetResource @testParameters
                    $result.ServerName | Should -Be $testParameters.ServerName
                    $result.InstanceName | Should -Be $testParameters.InstanceName
                    $result.EndpointName | Should -Be $testParameters.EndpointName
                    $result.Port | Should -Be $mockEndpointListenerPort
                    $result.IpAddress | Should -Be $mockEndpointListenerIpAddress
                    $result.Owner | Should -Be $mockEndpointOwner
                }

                It 'Should call the mock function Connect-SQL' {
                    $result = Get-TargetResource @testParameters
                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock return the endpoint with wrong endpoint type
                $mockDynamicEndpointType = $mockOtherEndpointType

                Context 'When endpoint exist but with wrong endpoint type' {
                    It 'Should throw the correct error' {
                        { Get-TargetResource @testParameters } | Should -Throw ($script:localizedData.EndpointFoundButWrongType -f $testParameters.EndpointName, $mockOtherEndpointType, $mockEndpointType)
                    }
                }

                # Make sure the mock return the endpoint with correct endpoint type
                $mockDynamicEndpointType = $mockEndpointType
            }

            # Make sure the mock returns the ServiceBroker endpoint
            $mockDynamicEndpointName = $mockSsbrEndpointName
            $mockDynamicEndpointType = $mockSsbrEndpointType
            $mockDynamicEndpointListenerPort = $mockSsbrEndpointListenerPort
            $mockDynamicEndpointListenerIpAddress = $mockSsbrEndpointListenerIpAddress
            $mockDynamicEndpointOwner = $mockSsbrEndpointOwner
            $mockDynamicIsMessageForwardingEnabled = $mockSsbrIsMessageForwardingEnabled
            $mockDynamicMessageForwardingSize = $mockSsbrMessageForwardingSize

            Context 'When the system is in the desired state (ServiceBroker)' {
                It 'Should return the desired state as present' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()
                    $result = Get-TargetResource @testParameters
                    $result.Ensure | Should -Be 'Present'
                }

                It 'Should return the same values as passed as parameters' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()
                    $result = Get-TargetResource @testParameters
                    $result.ServerName | Should -Be $testParameters.ServerName
                    $result.InstanceName | Should -Be $testParameters.InstanceName
                    $result.EndpointName | Should -Be $testParameters.EndpointName
                    $result.Port | Should -Be $mockSsbrEndpointListenerPort
                    $result.IpAddress | Should -Be $mockSsbrEndpointListenerIpAddress
                    $result.Owner | Should -Be $mockSsbrEndpointOwner
                    $result.IsMessageForwardingEnabled | Should -Be $mockSsbrIsMessageForwardingEnabled
                    $result.MessageForwardingSize | Should -Be $mockSsbrMessageForwardingSize
                }

                It 'Should call the mock function Connect-SQL' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()
                    $result = Get-TargetResource @testParameters
                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock return the endpoint with wrong endpoint type
                $mockDynamicEndpointType = $mockOtherEndpointType

                Context 'When endpoint exist but with wrong endpoint type' {
                    It 'Should throw the correct error' {
                        #Setting parameters here because of the beforeeach block.
                        $testParameters = $defaultSsbrParameters.Clone()
                        { Get-TargetResource @testParameters } | Should -Throw ($script:localizedData.EndpointFoundButWrongType -f $testParameters.EndpointName, $mockOtherEndpointType, $mockSSbrEndpointType)
                    }
                }

                # Make sure the mock return the endpoint with original endpoint type
                $mockDynamicEndpointName = $mockEndpointName
                $mockDynamicEndpointType = $mockEndpointType
                $mockDynamicEndpointListenerPort = $mockEndpointListenerPort
                $mockDynamicEndpointListenerIpAddress = $mockEndpointListenerIpAddress
                $mockDynamicEndpointOwner = $mockEndpointOwner
                $mockDynamicIsMessageForwardingEnabled = $null
                $mockDynamicMessageForwardingSize = $null
            }

            $testParameters = $defaultParameters.Clone()

            Context 'When Connect-SQL returns nothing' {
                It 'Should throw the correct error' {
                    Mock -CommandName Connect-SQL -MockWith {
                        return $null
                    }

                    { Get-TargetResource @testParameters } | Should -Throw ($script:localizedData.NotConnectedToInstance -f $testParameters.ServerName, $testParameters.InstanceName)
                }
            }

            Assert-VerifiableMock
        }

        Describe 'DSC_SqlEndpoint\Test-TargetResource' -Tag 'Test' {
            BeforeEach {
                $testParameters = $defaultParameters.Clone()

                Mock -CommandName Connect-SQL -MockWith $mockConnectSql -Verifiable
            }

            Context 'When the system is not in the desired state' {
                # Make sure the mock does not return the correct endpoint
                $mockDynamicEndpointName = $mockOtherEndpointName

                It 'Should return that desired state is absent when wanted desired state is to be Present (using default values)' {
                    $testParameters.Add('Ensure', 'Present')

                    $result = Test-TargetResource @testParameters
                    $result | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                It 'Should return that desired state is absent when wanted desired state is to be Present (setting all parameters)' {
                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockEndpointListenerPort)
                    $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)
                    $testParameters.Add('Owner', $mockEndpointOwner)

                    $result = Test-TargetResource @testParameters
                    $result | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock do return the correct endpoint
                $mockDynamicEndpointName = $mockEndpointName

                It 'Should return that desired state is absent when wanted desired state is to be Absent' {
                    $testParameters.Add('Ensure', 'Absent')

                    $result = Test-TargetResource @testParameters
                    $result | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock do return the correct endpoint, but does not return the correct endpoint listener port
                $mockDynamicEndpointName = $mockEndpointName
                $mockDynamicEndpointListenerPort = $mockOtherEndpointListenerPort

                Context 'When listener port is not in desired state' {
                    It 'Should return that desired state is absent' {
                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('Port', $mockEndpointListenerPort)

                        $result = Test-TargetResource @testParameters
                        $result | Should -BeFalse

                        Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                    }
                }

                Context 'When State is not in desired state' {
                    It 'Should return that desired state is absent' {
                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('State', 'Stopped')

                        $result = Test-TargetResource @testParameters
                        $result | Should -BeFalse

                        Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                    }
                }

                # Make sure the mock do return the correct endpoint listener port
                $mockDynamicEndpointListenerPort = $mockEndpointListenerPort

                # Make sure the mock do return the correct endpoint, but does not return the correct endpoint listener IP address
                $mockDynamicEndpointName = $mockEndpointName
                $mockDynamicEndpointListenerIpAddress = $mockOtherEndpointListenerIpAddress

                Context 'When listener IP address is not in desired state' {
                    It 'Should return that desired state is absent' {
                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)

                        $result = Test-TargetResource @testParameters
                        $result | Should -BeFalse

                        Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                    }
                }

                # Make sure the mock do return the correct endpoint listener IP address
                $mockDynamicEndpointListenerIpAddress = $mockEndpointListenerIpAddress

                # Make sure the mock do return the correct endpoint, but does not return the correct endpoint owner
                $mockDynamicEndpointName = $mockEndpointName
                $mockDynamicEndpointOwner = $mockOtherEndpointOwner

                Context 'When listener Owner is not in desired state' {
                    It 'Should return that desired state is absent' {
                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('Owner', $mockEndpointOwner)

                        $result = Test-TargetResource @testParameters
                        $result | Should -BeFalse

                        Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                    }
                }

                # Make sure the mock return the endpoint with ServiceBroker endpoint type
                $mockDynamicEndpointName = $mockSsbrEndpointName
                $mockDynamicEndpointType = $mockSsbrEndpointType
                $mockDynamicEndpointListenerPort = $mockSsbrEndpointListenerPort
                $mockDynamicEndpointListenerIpAddress = $mockSsbrEndpointListenerIpAddress
                $mockDynamicEndpointOwner = $mockSsbrEndpointOwner
                $mockDynamicIsMessageForwardingEnabled = $false
                $mockDynamicMessageForwardingSize = 1
                $mockDynamicEndpointState = 'Started'

                Context 'When ServiceBroker message forwarding is not in desired state' {
                    It 'Should return that desired state is absent' {
                        $testParameters = $defaultSsbrParameters.Clone()
                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('IsMessageForwardingEnabled', $mockSsbrIsMessageForwardingEnabled)

                        $result = Test-TargetResource @testParameters
                        $result | Should -BeFalse

                        Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                    }
                }

                Context 'When ServiceBroker message forwarding size is not in desired state' {
                    It 'Should return that desired state is absent' {
                        $testParameters = $defaultSsbrParameters.Clone()
                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('MessageForwardingSize', $mockSsbrMessageForwardingSize)

                        $result = Test-TargetResource @testParameters
                        $result | Should -BeFalse

                        Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                    }
                }

                # Make sure the mock return the endpoint with original endpoint type
                $mockDynamicEndpointName = $mockEndpointName
                $mockDynamicEndpointType = $mockEndpointType
                $mockDynamicEndpointListenerPort = $mockEndpointListenerPort
                $mockDynamicEndpointListenerIpAddress = $mockEndpointListenerIpAddress
                $mockDynamicEndpointOwner = $mockEndpointOwner
                $mockDynamicIsMessageForwardingEnabled = $null
                $mockDynamicMessageForwardingSize = $null
                $mockDynamicEndpointState = 'Started'

                # Make sure the mock do return the correct endpoint owner
                $mockDynamicEndpointOwner = $mockEndpointOwner
            }

            $testParameters = $defaultParameters.Clone()

            Context 'When the system is in the desired state' {
                # Make sure the mock do return the correct endpoint
                $mockDynamicEndpointName = $mockEndpointName

                It 'Should return that desired state is present when wanted desired state is to be Present (using default values)' {
                    $result = Test-TargetResource @testParameters
                    $result | Should -BeTrue

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock does not return the correct endpoint
                $mockDynamicEndpointName = $mockOtherEndpointName

                It 'Should return that desired state is present when wanted desired state is to be Absent' {
                    $testParameters.Add('Ensure', 'Absent')

                    $result = Test-TargetResource @testParameters
                    $result | Should -BeTrue

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }
            }

            Assert-VerifiableMock
        }

        Describe 'DSC_SqlEndpoint\Set-TargetResource' -Tag 'Set' {
            BeforeEach {
                $testParameters = $defaultParameters.Clone()

                Mock -CommandName Connect-SQL -MockWith $mockConnectSql -Verifiable
                Mock -CommandName New-Object -MockWith $mockNewObjectEndPoint -ParameterFilter $mockNewObjectEndPoint_ParameterFilter -Verifiable
            }

            Context 'When the system is not in the desired state' {
                # Make sure the mock do return the correct endpoint
                $mockDynamicEndpointName = $mockEndpointName

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Create() method is called.
                $mockExpectedNameWhenCallingMethod = $mockEndpointName

                It 'Should call the method Create when desired state is to be Present (using default values)' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Absent'
                        }
                    } -Verifiable

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeTrue
                    $script:mockMethodStartRan | Should -BeTrue
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Create() method is called.
                $mockExpectedNameWhenCallingMethod = $mockEndpointName

                It 'Should call the method Create when desired state is to be Present (setting all parameters for Mirror endpoint)' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Absent'
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockEndpointListenerPort)
                    $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)
                    $testParameters.Add('Owner', $mockEndpointOwner)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeTrue
                    $script:mockMethodStartRan | Should -BeTrue
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                $mockExpectedNameWhenCallingMethod = $mockSsbrEndpointName
                $mockDynamicEndpointName = $mockSsbrEndpointName

                It 'Should call the method Create when desired state is to be Present (setting parameters for ServiceBroker endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Absent'
                        }
                    } -Verifiable

                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('Ensure', 'Present')

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeTrue
                    $script:mockMethodStartRan | Should -BeTrue
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should call the method Alter when desired state is to be Present (setting Port parameter for endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                        }
                    } -Verifiable

                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockSsbrEndpointListenerPort)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should call the method Alter when desired state is to be Present (setting IpAddress parameter for endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                        }
                    } -Verifiable

                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('IpAddress', $mockSsbrEndpointListenerIpAddress)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should call the method Alter when desired state is to be Present (setting Owner parameter for endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                        }
                    } -Verifiable
                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Owner', $mockSsbrEndpointOwner)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should call the method Alter when desired state is to be Present (setting IsMessageForwardingEnabled parameter for ServiceBroker endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            IsMessageForwardingEnabled = $False
                        }
                    } -Verifiable
                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('IsMessageForwardingEnabled', $mockSsbrIsMessageForwardingEnabled)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should call the method Alter when desired state is to be Present (setting MessageForwardingSize parameters for ServiceBroker endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            IsMessageForwardingEnabled = $true
                            MessageForwardingSize = 1
                        }
                    } -Verifiable
                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('MessageForwardingSize', $mockSsbrMessageForwardingSize)

                    { Set-TargetResource @testParameters } | Should -Not -Throw

                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Drop() method is called.
                $mockExpectedNameWhenCallingMethod = $mockEndpointName
                $mockDynamicEndpointName = $mockEndpointName

                It 'Should call the method Drop when desired state is to be Absent' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Absent')

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeTrue

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Alter() method is called. (Mirror)
                $mockExpectedNameWhenCallingMethod = $mockEndpointName

                It 'Should call Alter method when listener port is not in desired state' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            Port = $mockEndpointListenerPort
                            IpAddress = $mockEndpointListenerIpAddress
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockOtherEndpointListenerPort)
                    $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)
                    $testParameters.Add('Owner', $mockEndpointOwner)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Alter() method is called. (ServiceBroker)
                $mockExpectedNameWhenCallingMethod = $mockSsbrEndpointName
                $mockDynamicEndpointName = $mockSsbrEndpointName

                It 'Should call the method Alter when desired state is to be Present (setting all parameters for ServiceBroker endpoint)' {
                    #Setting parameters here because of the beforeeach block.
                    $testParameters = $defaultSsbrParameters.Clone()

                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            Port = $mockEndpointListenerPort
                            IpAddress = $mockEndpointListenerIpAddress
                            IsMessageForwardingEnabled = $false
                            MessageForwardingSize = 1
                        }
                    } -Verifiable

                    $testParameters.EndpointName = $mockSsbrEndpointName
                    $testParameters.EndpointType = $mockSsbrEndpointType
                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockEndpointListenerPort)
                    $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)
                    $testParameters.Add('Owner', $mockEndpointOwner)
                    $testParameters.Add('IsMessageForwardingEnabled', $mockSsbrIsMessageForwardingEnabled)
                    $testParameters.Add('MessageForwardingSize', $mockSsbrMessageForwardingSize)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Alter() method is called.
                $mockExpectedNameWhenCallingMethod = $mockEndpointName
                $mockDynamicEndpointName = $mockEndpointName

                It 'Should call Alter method when listener IP address is not in desired state' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            Port = $mockEndpointListenerPort
                            IpAddress = $mockEndpointListenerIpAddress
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockEndpointListenerPort)
                    $testParameters.Add('IpAddress', $mockOtherEndpointListenerIpAddress)
                    $testParameters.Add('Owner', $mockEndpointOwner)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                # Set what the expected endpoint name should be when Alter() method is called.
                $mockExpectedNameWhenCallingMethod = $mockEndpointName

                It 'Should call Alter method when Owner is not in desired state' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            Owner = $mockEndpointOwner
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Owner', $mockOtherEndpointOwner)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeTrue
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false
                $script:mockMethodStopRan = $false
                $script:mockMethodDisableRan = $false

                $mockDynamicEndpointState = 'Stopped'

                It 'Should call Start() method when State is not ''Started''' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            State = 'Stopped'
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('State', 'Started')

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeTrue
                    $script:mockMethodStopRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse
                    $script:mockMethodDisableRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false
                $script:mockMethodStopRan = $false
                $script:mockMethodDisableRan = $false

                $mockDynamicEndpointState = 'Running'

                It 'Should call Stop() method when State is not ''Stopped''' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            State = 'Running'
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('State', 'Stopped')

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodStopRan | Should -BeTrue
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse
                    $script:mockMethodDisableRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false
                $script:mockMethodStopRan = $false
                $script:mockMethodDisableRan = $false

                $mockDynamicEndpointState = 'Running'

                It 'Should call Disable() method when State is not ''Disabled''' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            State = 'Running'
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('State', 'Disabled')

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodStopRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse
                    $script:mockMethodDisableRan | Should -BeTrue

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock does not return the correct endpoint
                $mockDynamicEndpointName = $mockOtherEndpointName

                Context 'When endpoint is missing when Ensure is set to Present' {
                    It 'Should throw the correct error' {
                        Mock -CommandName Get-TargetResource -MockWith {
                            return @{
                                Ensure = 'Present'
                            }
                        } -Verifiable

                        { Set-TargetResource @testParameters } | Should -Throw ($script:localizedData.EndpointNotFound -f $testParameters.EndpointName)
                    }
                }

                Context 'When endpoint is missing when Ensure is set to Absent' {
                    It 'Should throw the correct error' {
                        Mock -CommandName Get-TargetResource -MockWith {
                            return @{
                                Ensure = 'Present'
                            }
                        } -Verifiable

                        $testParameters.Add('Ensure', 'Absent')

                        { Set-TargetResource @testParameters } | Should -Throw ($script:localizedData.EndpointNotFound -f $testParameters.EndpointName)
                    }
                }

                Context 'When Connect-SQL returns nothing' {
                    It 'Should throw the correct error' {
                        Mock -CommandName Get-TargetResource -Verifiable
                        Mock -CommandName Connect-SQL -MockWith {
                            return $null
                        }

                        { Set-TargetResource @testParameters } | Should -Throw ($script:localizedData.NotConnectedToInstance -f $testParameters.ServerName, $testParameters.InstanceName)
                    }
                }
            }

            Context 'When the system is in the desired state' {
                # Make sure the mock do return the correct endpoint
                $mockDynamicEndpointName = $mockEndpointName
                $mockDynamicEndpointListenerPort = $mockEndpointListenerPort
                $mockDynamicEndpointListenerIpAddress = $mockEndpointListenerIpAddress
                $mockDynamicEndpointOwner = $mockEndpointOwner

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should not call any methods when desired state is already Present' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Present'
                            Port = $mockEndpointListenerPort
                            IpAddress = $mockEndpointListenerIpAddress
                            Owner = $mockEndpointOwner
                            IsMessageForwardingEnabled = $mockSsbrIsMessageForwardingEnabled
                            MessageForwardingSize = $mockSsbrMessageForwardingSize
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Present')
                    $testParameters.Add('Port', $mockEndpointListenerPort)
                    $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)
                    $testParameters.Add('Owner', $mockEndpointOwner)
                    $testParameters.Add('IsMessageForwardingEnabled', $mockSsbrIsMessageForwardingEnabled)
                    $testParameters.Add('MessageForwardingSize', $mockSsbrMessageForwardingSize)

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }

                # Make sure the mock does not return the correct endpoint
                $mockDynamicEndpointName = $mockOtherEndpointName

                # Set all method call tests variables to $false
                $script:mockMethodCreateRan = $false
                $script:mockMethodStartRan = $false
                $script:mockMethodAlterRan = $false
                $script:mockMethodDropRan = $false

                It 'Should not call any methods when desired state is already Absent' {
                    Mock -CommandName Get-TargetResource -MockWith {
                        return @{
                            Ensure = 'Absent'
                        }
                    } -Verifiable

                    $testParameters.Add('Ensure', 'Absent')

                    { Set-TargetResource @testParameters } | Should -Not -Throw
                    $script:mockMethodCreateRan | Should -BeFalse
                    $script:mockMethodStartRan | Should -BeFalse
                    $script:mockMethodAlterRan | Should -BeFalse
                    $script:mockMethodDropRan | Should -BeFalse

                    Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It
                }
            }

            # Make sure the mock do return the correct endpoint
            $mockDynamicEndpointName = $mockEndpointName
            $mockExpectedNameWhenCallingMethod = $mockOtherEndpointName

            Context 'Testing mocks' {
                Context 'When mocked Create() method is called with the wrong endpoint name' {
                    It 'Should throw the correct error' {
                        Mock -CommandName Get-TargetResource -MockWith {
                            return @{
                                Ensure = 'Absent'
                            }
                        } -Verifiable

                        { Set-TargetResource @testParameters } | Should -Throw 'Exception calling "Create" with "0" argument(s): "Called mocked Create() method on and endpoint with wrong name. Expected ''UnknownEndpoint''. But was ''DefaultEndpointMirror''."'
                    }
                }

                Context 'When mocked Drop() method is called with the wrong endpoint name' {
                    It 'Should throw the correct error' {
                        Mock -CommandName Get-TargetResource -MockWith {
                            return @{
                                Ensure = 'Present'
                            }
                        } -Verifiable

                        $testParameters.Add('Ensure', 'Absent')

                        { Set-TargetResource @testParameters } | Should -Throw 'Exception calling "Drop" with "0" argument(s): "Called mocked Drop() method on and endpoint with wrong name. Expected ''UnknownEndpoint''. But was ''DefaultEndpointMirror''."'
                    }
                }

                Context 'When mocked Alter() method is called with the wrong endpoint name' {
                    It 'Should throw the correct error' {
                        Mock -CommandName Get-TargetResource -MockWith {
                            return @{
                                Ensure = 'Present'
                                Port = $mockEndpointListenerPort
                                IpAddress = $mockEndpointListenerIpAddress
                            }
                        } -Verifiable

                        $testParameters.Add('Ensure', 'Present')
                        $testParameters.Add('Port', $mockOtherEndpointListenerPort)
                        $testParameters.Add('IpAddress', $mockEndpointListenerIpAddress)
                        $testParameters.Add('Owner', $mockEndpointOwner)

                        { Set-TargetResource @testParameters } | Should -Throw 'Exception calling "Alter" with "0" argument(s): "Called mocked Alter() method on and endpoint with wrong name. Expected ''UnknownEndpoint''. But was ''DefaultEndpointMirror''."'
                    }
                }
            }

            Assert-VerifiableMock
        }
    }
}
finally
{
    Invoke-TestCleanup
}

redpajama_set_name: RedPajamaGithub


text:
HomeElectricityHungary-Slovenia interconnection is in operation
Hungary-Slovenia interconnection is in operation
By Claudia Patricolo
Slovenia's Transmission System Operator (TSO) ELES and the Hungarian one MAVIR announced that the planned physical connection between the Hungarian and the Slovenian electricity systems was established.
Preliminary tests and measurements of the newly built international connection were successfully carried out, which will provide a more stable and reliable operation of the electricity system at the 400 kilovolts (kV) voltage level and contribute to an even stronger connection of the mentioned markets to common EU internal electricity market.
Negotiations had already been launched concerning constructing a Hungarian-Croatian-Slovenian 400 kV transmission grid connection in the mid-1990s, the last phase of which was constructing the Cirkovce-Pince transmission line. Slovenia is the last neighbouring country with which Hungary has not had a transmission line connection. On the Hungarian side, a double-circuit tie-line between Hévíz and the Slovenian-Croatian-Hungarian triple border was completed before the turn of the millennium via the investment of MVM – the Hungarian Electricity Company – then owner of the transmission grid. As part of this, a 5-kilometre branch of the future Slovenian transmission line, in the direction of Slovenia, was built on the Hungarian side, creating an opportunity for later connection. The Slovenian system has now been connected to this branch.
"The new interconnection will not only have a trade effect, but it will also strengthen the security of supply, noted thePresident of the Hungarian Energy and Public Utility Regulatory Authority (MEKH), Péter János Horváth. "The transmission system operators of the neighbouring countries with coupled networks cooperate also by concluding international agreements to prevent the negative effects of power deficit and to manage network congestions. Our objective is to conclude, as soon as possible, such an agreement between the Hungarian and the Slovenian system operators as well."
As of 30 June 2022, the transmission line is operating as testing and trial-run are underway. From the market perspective, the interconnection will be included in the cross-border capacity calculation process starting from 6 July 2022.
Photos: ELES.
Sign up to our biweekly newsletter
Role (required)
electricity grid
ELES
Mavir
Hungary's Paks-2 project could enter construction phase in September says FM
Volvo Cars to establish a carbon-neutral manufacturing plant for e-vehicles in Slovakia
Filip Derewenda - January 27, 2023
Latvian energy infrastructure operators prepare to build cyber security capabilities
Evelin Szőke - January 23, 2023
Polish TAURON strengthens energy security of KGHM's Copper Belt